Skip to content

Websocket Support with -sMEMORY64 #21503

Closed
@tbuchs

Description

@tbuchs

Hi, tried adding the flag -sMEMORY64 in my program and changed a few things to compile. The program uses websockets from emscripten and uses -sPROXY_TO_PTHREAD. Are Websockets supported yet with MEMORY64?

My code:

if (!emscripten_websocket_is_supported())
{
cerr << "WebSockets are not supported, cannot continue!" << endl;
exit(1);
}

EmscriptenWebSocketCreateAttributes attr;
emscripten_websocket_init_create_attributes(&attr);
attr.url = "ws://localhost:8080";
attr.createOnMainThread = true; // WebSockets in WASM64 are only supported on the main thread?
websocket_conn = emscripten_websocket_new(&attr);
if (websocket_conn <= 0)
{
   cerr << "WebSocket creation failed, error code " << (EMSCRIPTEN_RESULT)websocket_conn << "!" << endl;
   exit(1);
}

emscripten_websocket_set_onopen_callback(websocket_conn, this, WebSocketOpen);
emscripten_websocket_set_onmessage_callback(websocket_conn, this, WebSocketMessage);
emscripten_websocket_set_onclose_callback(websocket_conn, nullptr, WebSocketClose);
emscripten_websocket_set_onerror_callback(websocket_conn, nullptr, WebSocketError);

When I compile the program and use the debug websocket flag, I get the following output:

emscripten_websocket_set_onopen_callback(socketId=1,userData=1720776,callbackFunc='+callbackFunc})
emscripten_websocket_set_onmessage_callback(socketId=1,userData=1720776,callbackFunc=2621) 
emscripten_websocket_set_onclose_callback(socketId=1,userData=0,callbackFunc=2622) 
emscripten_websocket_set_onerror_callback(socketId=1,userData=0,callbackFunc=2623) 
checkStackCookie: 0x0018ef50
websocket event "open": socketId=1,userData=1720776,callbackFunc=2620) 
Uncaught Internal Error! Attempted to invoke wasm function pointer with signature "iiii", but no such functions have gotten exported!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions