mirror of
https://github.com/defold/extension-websocket.git
synced 2025-06-27 09:47:44 +02:00
Merge pull request #24 from defold/issue-22-skip-protocol-by-default
Issue 22: Don't send Sec-WebSocket-Protocol unless specified
This commit is contained in:
commit
ba7454a431
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
- name: protocol
|
- name: protocol
|
||||||
type: string
|
type: string
|
||||||
desc: the protocol to use (e.g. 'chat'). (Default is 'binary')
|
desc: the protocol to use (e.g. 'chat'). If not set, no `Sec-WebSocket-Protocol` header is sent.
|
||||||
|
|
||||||
- name: headers
|
- name: headers
|
||||||
type: string
|
type: string
|
||||||
|
@ -712,12 +712,10 @@ static dmExtension::Result OnUpdate(dmExtension::Params* params)
|
|||||||
#if defined(__EMSCRIPTEN__)
|
#if defined(__EMSCRIPTEN__)
|
||||||
conn->m_SSLSocket = dmSSLSocket::INVALID_SOCKET_HANDLE;
|
conn->m_SSLSocket = dmSSLSocket::INVALID_SOCKET_HANDLE;
|
||||||
|
|
||||||
if (conn->m_Protocol) {
|
EM_ASM({
|
||||||
EM_ASM({
|
// https://emscripten.org/docs/porting/networking.html#emulated-posix-tcp-sockets-over-websockets
|
||||||
// https://emscripten.org/docs/porting/networking.html#emulated-posix-tcp-sockets-over-websockets
|
Module["websocket"]["subprotocol"] = $0 ? UTF8ToString($0) : null;
|
||||||
Module["websocket"]["subprotocol"] = UTF8ToString($0);
|
}, conn->m_Protocol);
|
||||||
}, conn->m_Protocol);
|
|
||||||
}
|
|
||||||
|
|
||||||
char uri_buffer[dmURI::MAX_URI_LEN];
|
char uri_buffer[dmURI::MAX_URI_LEN];
|
||||||
const char* uri;
|
const char* uri;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user