-
-
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
[jquery] when websocket is reconnected I have no event fired #529
Comments
Actually it works all the time for me. Just tested with atmosphere-chat.war and Chrome. Closing as not a bug, if you can share your latest war privately I will take a look (haven't yet has a chance to look at your disconnect issue). |
what event should fire after the reconnect? I do see that the reconnect is called and tries to reconnect but after is reconnects - no event is fired. By the way - is it possible to add a simple method that will return if the websocket is connected or not? (or just add a property inside the request object) |
I've also went over the code and if you go to line 970: if (!webSocketOpened) { webSocketOpened = true; then after the first connection it wont go into the onOpen event cause the webSocketOpened = true; will stay always true. //if (!webSocketOpened) { Please double check and let me know. (tested both on Chrome and firefox with beta4) |
That's expected. You will get the re-opening event and you don't want to get the 'open' again. Why do you specifically needs 'opening' events? |
well - I want to show an icon to the user that will show if he's connected or not. So this is the scenario:
|
You can by catching the re-opening events. As an example, just write: request.onReconnect = function (request, response) {
}; but I see you point, e.g you want to get the event at the same moment you are getting the 'onpening' events. Let me thing of it. |
solved it like so (line 971): " |
I agree it will works for your case, but it will break other transport On 12-07-30 8:25 AM, poi212003 wrote:
|
I have the same issue. With the current atmosphere.js its very hard to track when a connection is actually successfully opened. You know when it's opening. You can only assume that: if after the opOpen you dont get onError, onClose or onReconnect you have a "good" connection. Same story with onReconnect. I want also translate the state of the request (with any transport): we have now opening, closed, reconnecting and error. But 'opened' state is missing. Another issue is that if you have some post connect code that you want to execute when connection is made and post connect relies on websocket or comet connections you get lots of issues if atmosphere fails to open or reconnect. |
@hapali It's pretty hard to implement what you want without writing a protocol on top of Atmosphere. I'm open to contribution :-) |
@jfarcand I will give it a try |
Fixed in 1.0.0.RC1 |
(basiclly I just want to create an icon that will show if we're connected or not just like messenger apps)
The text was updated successfully, but these errors were encountered: