mirror of
https://github.com/defold/extension-websocket.git
synced 2025-09-30 09:12:18 +02:00
Added status code to callback when the server closes the connection (#45)
* Added WebSocket close code to callback Also added message and code for HTML5 * Unify disconnect handling for wslay and html5
This commit is contained in:
@@ -80,6 +80,7 @@ namespace dmWebsocket
|
||||
|
||||
struct Message
|
||||
{
|
||||
uint16_t m_Code;
|
||||
uint32_t m_Length:30;
|
||||
uint32_t m_Type:2;
|
||||
};
|
||||
@@ -129,6 +130,7 @@ namespace dmWebsocket
|
||||
int m_BufferSize;
|
||||
uint32_t m_BufferCapacity;
|
||||
Result m_Status;
|
||||
uint16_t m_CloseCode;
|
||||
uint8_t m_SSL:1;
|
||||
uint8_t m_HasHandshakeData:1;
|
||||
uint8_t :7;
|
||||
@@ -159,7 +161,7 @@ namespace dmWebsocket
|
||||
void HandleCallback(WebsocketConnection* conn, int event, int msg_offset, int msg_length);
|
||||
|
||||
// Messages
|
||||
Result PushMessage(WebsocketConnection* conn, MessageType type, int length, const uint8_t* msg);
|
||||
Result PushMessage(WebsocketConnection* conn, MessageType type, int length, const uint8_t* msg, uint16_t code);
|
||||
|
||||
#if defined(HAVE_WSLAY)
|
||||
// Wslay callbacks
|
||||
|
Reference in New Issue
Block a user