1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Implement WebSocket close notify.

This commit is contained in:
Fabio Alessandrelli
2018-09-23 21:14:20 +02:00
parent 399910ddd8
commit 5d91e87c64
18 changed files with 116 additions and 30 deletions

View File

@@ -53,6 +53,9 @@ private:
WriteMode write_mode;
bool _was_string;
int close_code;
String close_reason;
public:
struct PeerData {
uint32_t peer_id;
@@ -71,7 +74,7 @@ public:
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 void close();
virtual void close(int p_code = 1000, String p_reason = "");
virtual bool is_connected_to_host() const;
virtual IP_Address get_connected_host() const;
virtual uint16_t get_connected_port() const;
@@ -83,6 +86,8 @@ public:
void set_wsi(struct lws *wsi);
Error read_wsi(void *in, size_t len);
Error write_wsi();
void send_close_status(struct lws *wsi);
String get_close_reason(void *in, size_t len, int &r_code);
LWSPeer();
~LWSPeer();