mirror of
https://github.com/defold/extension-websocket.git
synced 2025-06-27 01:47:42 +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
|
||||
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
|
||||
type: string
|
||||
|
@ -712,12 +712,10 @@ static dmExtension::Result OnUpdate(dmExtension::Params* params)
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
conn->m_SSLSocket = dmSSLSocket::INVALID_SOCKET_HANDLE;
|
||||
|
||||
if (conn->m_Protocol) {
|
||||
EM_ASM({
|
||||
// https://emscripten.org/docs/porting/networking.html#emulated-posix-tcp-sockets-over-websockets
|
||||
Module["websocket"]["subprotocol"] = UTF8ToString($0);
|
||||
Module["websocket"]["subprotocol"] = $0 ? UTF8ToString($0) : null;
|
||||
}, conn->m_Protocol);
|
||||
}
|
||||
|
||||
char uri_buffer[dmURI::MAX_URI_LEN];
|
||||
const char* uri;
|
||||
|
Loading…
x
Reference in New Issue
Block a user