Skip to content
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

Error 1006, JS gets disconnected when CPP sends data #35

Open
benkuper opened this issue Jun 17, 2020 · 0 comments
Open

Error 1006, JS gets disconnected when CPP sends data #35

benkuper opened this issue Jun 17, 2020 · 0 comments

Comments

@benkuper
Copy link

Hello, I'm testing juce_mongoose, which is a direct port of mongoose-cpp (I checked that the code is the same for this issue).

When testing the websocket example - I modified it a bit to send 10 messages in a row instead of just one -, the websocketReady function gets called at every new message, but the websocketdata gets called randomly (2 times out of 100).
I tried to trace back a bit and it seems that the function "event_handler" (Server.cpp line 39) gets called at every message, and then the "websocketReady" gets called immediately. This then goes into Websockets::add and it replaces the previous connection all the time.

I'm not sure what should be done, but I would expect that webSocketready gets only called once, and then websocketdata gets called for all the incoming data, right ?

On the browser side, the Websocket is behaving "normally", meaning that it detects a connection at first, sends the message, receive some.
Though it receives a disconnection in the end even though I didn't close the websocket on the cpp side...

Also, in websocketReady , the getId() return -1.

Thanks !

@benkuper benkuper changed the title websocketReady called on every message received instead of webSocketData Error 1006, JS gets disconnected when CPP sends data Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant