Skip to content

[wasm64] Fix WebSocket API under wasm64 #21514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/library_websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ var LibraryWebSocket = {
dbg(`websocket event "open": socketId=${socketId},userData=${userData},callbackFunc=${callbackFunc})`);
#endif
HEAPU32[WS.socketEvent>>2] = socketId;
{{{ makeDynCall('iiii', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
{{{ makeDynCall('iipp', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
}
return {{{ cDefs.EMSCRIPTEN_RESULT_SUCCESS }}};
},
Expand All @@ -181,7 +181,7 @@ var LibraryWebSocket = {
dbg(`websocket event "error": socketId=${socketId},userData=${userData},callbackFunc=${callbackFunc})`);
#endif
HEAPU32[WS.socketEvent>>2] = socketId;
{{{ makeDynCall('iiii', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
{{{ makeDynCall('iipp', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
}
return {{{ cDefs.EMSCRIPTEN_RESULT_SUCCESS }}};
},
Expand Down Expand Up @@ -210,7 +210,7 @@ var LibraryWebSocket = {
HEAPU32[(WS.socketEvent+4)>>2] = e.wasClean;
HEAPU32[(WS.socketEvent+8)>>2] = e.code;
stringToUTF8(e.reason, WS.socketEvent+10, 512);
{{{ makeDynCall('iiii', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
{{{ makeDynCall('iipp', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
}
return {{{ cDefs.EMSCRIPTEN_RESULT_SUCCESS }}};
},
Expand Down Expand Up @@ -262,7 +262,7 @@ var LibraryWebSocket = {
}
HEAPU32[(WS.socketEvent+4)>>2] = buf;
HEAPU32[(WS.socketEvent+8)>>2] = len;
{{{ makeDynCall('iiii', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
{{{ makeDynCall('iipp', 'callbackFunc') }}}(0/*TODO*/, WS.socketEvent, userData);
_free(buf);
}
return {{{ cDefs.EMSCRIPTEN_RESULT_SUCCESS }}};
Expand Down
8 changes: 8 additions & 0 deletions test/test_sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,3 +349,11 @@ def test_posix_proxy_sockets(self):
with PythonTcpEchoServerProcess('7777'):
# Build and run the TCP echo client program with Emscripten
self.btest_exit('websocket/tcp_echo_client.c', args=['-lwebsocket', '-sPROXY_POSIX_SOCKETS', '-pthread', '-sPROXY_TO_PTHREAD'])


class sockets64(sockets):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used anywhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you mean, is it run by CI anywhere, no, I just rand it locally.

def setUp(self):
super().setUp()
self.set_setting('MEMORY64')
self.emcc_args.append('-Wno-experimental')
self.require_wasm64()