|
@@ -48,6 +48,7 @@ typedef void (*WSOnError)(void *p_ref);
|
|
|
|
|
|
extern int godot_js_websocket_create(void *p_ref, const char *p_url, const char *p_proto, WSOnOpen p_on_open, WSOnMessage p_on_message, WSOnError p_on_error, WSOnClose p_on_close);
|
|
|
extern int godot_js_websocket_send(int p_id, const uint8_t *p_buf, int p_buf_len, int p_raw);
|
|
|
+extern int godot_js_websocket_buffered_amount(int p_id);
|
|
|
extern void godot_js_websocket_close(int p_id, int p_code, const char *p_reason);
|
|
|
extern void godot_js_websocket_destroy(int p_id);
|
|
|
}
|
|
@@ -62,14 +63,16 @@ private:
|
|
|
Vector<uint8_t> _packet_buffer;
|
|
|
PacketBuffer<uint8_t> _in_buffer;
|
|
|
uint8_t _is_string = 0;
|
|
|
+ int _out_buf_size = 0;
|
|
|
|
|
|
public:
|
|
|
Error read_msg(const uint8_t *p_data, uint32_t p_size, bool p_is_string);
|
|
|
- void set_sock(int p_sock, unsigned int p_in_buf_size, unsigned int p_in_pkt_size);
|
|
|
+ void set_sock(int p_sock, unsigned int p_in_buf_size, unsigned int p_in_pkt_size, unsigned int p_out_buf_size);
|
|
|
virtual int get_available_packet_count() const;
|
|
|
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size);
|
|
|
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
|
|
|
virtual int get_max_packet_size() const { return _packet_buffer.size(); };
|
|
|
+ virtual int get_current_outbound_buffered_amount() const;
|
|
|
|
|
|
virtual void close(int p_code = 1000, String p_reason = "");
|
|
|
virtual bool is_connected_to_host() const;
|