Skip to content

Websocket Support with -sMEMORY64 #21503

Closed

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!

Activity

  1. self-assigned this
    on Mar 11, 2024
  2. added a commit that references this issue on Mar 11, 2024
    12608ff
  3. added a commit that references this issue on Mar 12, 2024
    0b55292
  4. added a commit that references this issue on Apr 12, 2024
    baa07c9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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