Replies: 1 comment 3 replies
-
I'm not sure if this is the issue but you are creating a You should always be careful when taking the address of stack objects like this. Most likely you want to instead do |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I have a simple game project using among other classes emscripten and websockets.
The code is basically as followed:
I compile with following command:
em++ programcpp -lGL -sMIN_WEBGL_VERSION=2 -sMINIMAL_RUNTIME=1 --js-library library_program.js --js-library library_websocket.js -o program.html
The problem is that Websockets connection is not sending messages from main loop (result = emscripten_websocket_send_utf8_text(*(context->Ws), "Just testing");). The program just outputs:
Which indicates that there is something wrong with Ws pointer. The connection should be fine, since I'm seeing
ClosedOK: received 1001 (going away); then sent 1001 (going away)
server side messages after browser close.If add to main loop after
EMSCRIPTEN_WEBSOCKET_T ws = emscripten_websocket_new(&ws_attrs);
:Then I see that the direct call to ws is working since execution gives me a runtime error:
Uncaught (in promise) InvalidStateError: Failed to execute 'send' on 'WebSocket': Still in CONNECTING state.
So my question is that what am I doing wrong or missing here? I've double checked all the pointers, but again it is C...
BR,
-Risto
Beta Was this translation helpful? Give feedback.
All reactions