-
-
Notifications
You must be signed in to change notification settings - Fork 754
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
onOpen callback not invoked after Websocket connection fails and is restored #1121
Comments
Actually, |
@jdahlstrom Which version of Atmosphere are you using? Can you try with 1.0.13? For sure if you can use 1.1.0.RC3 there is an improved set of callback (like onReopen()) that will help. See this sample for an example. In 1.0.14, atmosphere.js will also be available so a backport is possible. |
Oh, sorry. I'm at Vaadin; we're using 1.0.13 and really wouldn't like to depend on a prerelease version. I wonder if we could just patch |
@jdahlstrom that will work, but onOpen will be opened called many times instead of just one. But if you handle the logic in your application, go for it. |
Okay, thanks! We need to do our own state bookkeeping anyway so that's not a problem. |
This is now fixed, onReopen will be called once the reconnection occurs. Thanks! |
If a Websocket connection fails (eg. due to a temporary network failure),
onClose()
is called on the client side and the client tries to open a new connection.When a reconnect attempt is made,
onReconnect()
is called. If the network is still down, the reconnection immediately fails andonClose()
is again called by the websocketonclose
handler. However, if the network is back up, the reconnection succeeds but the user then gets no notification that the connection was established (noonOpen()
called) and it's again possible topush()
. (Ifpush()
is called while the connection is down, it is a no-op due to_websocket
being null.)This is problematic, as even though we can notify the end user and disable the UI when the connection is lost, it's not possible to reliably know when the connection is restored and let the user to continue using the application. Neither can we queue a request and send it once we're back online. Another problem is that the original
onClose()
call doesn't provide any information that this was an unexpected close.Thanks for any help,
Johannes
The text was updated successfully, but these errors were encountered: