mirror of
https://github.com/defold/extension-websocket.git
synced 2025-09-30 01:02:18 +02:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
0f841f16af | ||
|
97cca427d7 |
@@ -251,10 +251,7 @@ static void CloseConnection(WebsocketConnection* conn)
|
|||||||
// we want it to send this message in the polling
|
// we want it to send this message in the polling
|
||||||
if (conn->m_State == STATE_CONNECTED) {
|
if (conn->m_State == STATE_CONNECTED) {
|
||||||
#if defined(HAVE_WSLAY)
|
#if defined(HAVE_WSLAY)
|
||||||
// close the connection and immediately transition to the DISCONNECTED
|
|
||||||
// state
|
|
||||||
WSL_Close(conn->m_Ctx);
|
WSL_Close(conn->m_Ctx);
|
||||||
SetState(conn, STATE_DISCONNECTED);
|
|
||||||
#else
|
#else
|
||||||
// start disconnecting by closing the WebSocket through the JS API
|
// start disconnecting by closing the WebSocket through the JS API
|
||||||
// we transition to the DISCONNECTED state when we receive the
|
// we transition to the DISCONNECTED state when we receive the
|
||||||
@@ -264,6 +261,11 @@ static void CloseConnection(WebsocketConnection* conn)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(HAVE_WSLAY)
|
||||||
|
// close the connection and immediately transition to the DISCONNECTED
|
||||||
|
// state
|
||||||
|
SetState(conn, STATE_DISCONNECTED);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsConnectionValid(WebsocketConnection* conn)
|
static bool IsConnectionValid(WebsocketConnection* conn)
|
||||||
@@ -819,7 +821,7 @@ static dmExtension::Result OnUpdate(dmExtension::Params* params)
|
|||||||
emscripten_websocket_set_onclose_callback(ws, conn, Emscripten_WebSocketOnClose);
|
emscripten_websocket_set_onclose_callback(ws, conn, Emscripten_WebSocketOnClose);
|
||||||
emscripten_websocket_set_onmessage_callback(ws, conn, Emscripten_WebSocketOnMessage);
|
emscripten_websocket_set_onmessage_callback(ws, conn, Emscripten_WebSocketOnMessage);
|
||||||
#else
|
#else
|
||||||
conn->m_ConnectionThread = dmThread::New((dmThread::ThreadStart)ConnectionWorker, 0x80000, conn, "WebSocketConnectionThread");
|
conn->m_ConnectionThread = dmThread::New((dmThread::ThreadStart)ConnectionWorker, 0x80000, conn, "WSConnect");
|
||||||
#endif
|
#endif
|
||||||
SetState(conn, STATE_CONNECTING);
|
SetState(conn, STATE_CONNECTING);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user