Version of emscripten/emsdk:
emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.57 (1df9c1977b49926c1efca672c31414da45c0c7bb)
clang version 19.0.0git (https:/github.com/llvm/llvm-project ccdebbae4d77d3efc236af92c22941de5d437e01)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /Users/yanxia/Desktop/emsdk/upstream/bin
Build config: +assertions
I try to get the code and reason in the close callback. Here is my code example.
EM_BOOL EmscriptenConnection::OnWebSocketClose(int eventType, const EmscriptenWebSocketCloseEvent *websocketEvent,
void *userData) {
auto connection = static_cast<EmscriptenConnection *>(userData);
unsigned short code = websocketEvent->code;
auto reason = websocketEvent->reason;
connection->connecting_ = false;
connection->connected_ = false;
if (connection->on_close_callback_) {
connection->on_close_callback_(connection, code, reason);
}
return EM_TRUE;
}
The problem is that the code the server sent is not the code I recieved. And I find in the line 220 of file library_websocket.js from the main branch right now, there is a typo.
Please include the following in your bug report:
Version of emscripten/emsdk: emcc -v emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.57 (1df9c1977b49926c1efca672c31414da45c0c7bb) clang version 19.0.0git (https:/github.com/llvm/llvm-project ccdebbae4d77d3efc236af92c22941de5d437e01) Target: wasm32-unknown-emscripten Thread model: posix InstalledDir: /Users/yanxia/Desktop/emsdk/upstream/bin Build config: +assertions
I try to get the code and reason in the close callback. Here is my code example.
The problem is that the code the server sent is not the code I recieved. And I find in the line 220 of file library_websocket.js from the main branch right now, there is a typo.
As a result, EmscriptenWebSocketCloseEvent->code is incorrect and EmscriptenWebSocketCloseEvent->wasClean somehow works as the code