-
Notifications
You must be signed in to change notification settings - Fork 81
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
No error fired when the network is off #247
Comments
The I have been struggling with this for a while now. The actual time taken to close the socket after issuing |
This is really interesting indeed... So, as the STOMP specs states that:
why don't fire a |
I see one possible workaround. When the web socket is closed after no heartbeat, all even handlers are set to no-op on the socket and assume WebSocket to be closed. This will allow to attempt a new connection. Please let me know if you would like to try this approach. |
What you suggest is a possible workaround on the existing library ? If it's the case, could you please show me how the client instance could be notified about the state change ? In any case I'll gladly test your approach |
I have created PR #250, please see the diff. Set Install from https://github.com/stomp-js/stompjs/raw/discardSockets/stomp-stompjs-5.4.5.tgz. Please let me know how it goes. I have also added a debug statement of actual socket closure. |
Brilliant! It works as expected 🙆♂️. Thank you very much 👍 |
Can you please attach your log file. I want to see how it behaves in the real life. |
As you can see once the network (wi-fi) is back again the websocket connection is finally closed (before attempting a new connection) So if fires the onWebSocketClose callback twice. This is a non-issue for me because it just put the app on the same state again.
|
Thanks, I want to also see how it works when the connectivity is down for a while. To simulate please set the reconnectDelay to 500ms and keep the WiFi off for few minutes. |
Released as part of 6.0.0. |
Hi, I think I'm missing some fundamentals about how stomp-js works with websockets and when it fires errors. I've set an heartbeat (incoming / outcoming ) on both server and client of 1000 milliseconds and the PING / PONG works fine. Now, when I set my network off (so the remote server is totally unreachable) I expect at least one of these errors :
onWebSocketClose, onWebSocketError, onDisconnect, onStompError
but none fires. I can see the message about the heartbeat ("did not receive server activity for the last XXXXms") but nothing else.Strange enough, when I set the network on again it fires
onWebSocketClose
once (just before the connection is re-established).Can you point me to some documentation/examples ?
// EDIT
It looks like
_websocket.close()
never happen, (shouldn't it be fired just after the first debug line ?)The text was updated successfully, but these errors were encountered: