summaryrefslogtreecommitdiff
path: root/modules/websocket/lws_peer.h
diff options
context:
space:
mode:
authorMax Hilbrunner <mhilbrunner@users.noreply.github.com>2018-09-24 06:29:30 +0200
committerGitHub <noreply@github.com>2018-09-24 06:29:30 +0200
commitaaef640b8c3e7c7c49aae11a1c8c9e606223fefd (patch)
tree384a64093351ad6c8db4e20fcde8b3403404e9fe /modules/websocket/lws_peer.h
parent399910ddd82e84f078ebefb3ed2c51d2ef989235 (diff)
parentdf43b94e6ebaad30991e7b909f40cd89aee9d6fd (diff)
Merge pull request #22383 from Faless/ws_close
Implement WebSocket close frame handling
Diffstat (limited to 'modules/websocket/lws_peer.h')
-rw-r--r--modules/websocket/lws_peer.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/websocket/lws_peer.h b/modules/websocket/lws_peer.h
index d7d46e3076..571445db01 100644
--- a/modules/websocket/lws_peer.h
+++ b/modules/websocket/lws_peer.h
@@ -53,10 +53,14 @@ private:
WriteMode write_mode;
bool _was_string;
+ int close_code;
+ String close_reason;
+
public:
struct PeerData {
uint32_t peer_id;
bool force_close;
+ bool clean_close;
};
RingBuffer<uint8_t> rbw;
@@ -71,7 +75,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 +87,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();