-
Notifications
You must be signed in to change notification settings - Fork 980
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
When does the socket stop to try to emit a message when connection is lost? #322
Comments
I think SocketIO not implemented re emit function because I have found the same problem,an than I implemented a message buffer to handle re emit when SocketIO reconnect by self. |
As I said, the socket apparently does reemit. When I call socket.emit while there is no connection to the internet and then turn the wifi on after some seconds, the message is sent to the server |
I think appear re-emit only in a few seconds when socketio reconnect,if no connection too long(more than one minute),will not happen. I have tried it so I manually handle it ensure message can be re-emit. |
Yeah, the question is, how can I kow that the re-emit won't be executed anymore, so that I can shedule it manually again? "More than one minute" is not exact enough ;) (or is it??) I would think that re-emitting stops when the first EVENT_CONNECTION_ERROR or EVENT_DISSCONNECT occurs, but I can't find sth that assures that. Another solution would be to cancel an emit, but I also don't know if that's possible.. |
You right, these all my guess so expression is not exact enough. |
From what I see here: https://github.com/socketio/socket.io-client-java/blob/master/src/main/java/io/socket/client/Socket.java#L391 apparently it always tries to reemit? I tried again and even after 4 minutes of connection loss, it reemits. Apparently I made a mistake before. |
hey mate, even though this issue is already older I am facing the exact problem in javascript instead of Java. It sometimes reemits the messages as soon as the connection is back online and it sometimes doesn't, or just a part of all the emits during that time. Did you figure something out in the mean time? Or did you stop working with socket io? |
Sorry, I discontinued the project before I managed to find a fix. What you could do, is to handle the (re-)sending process yourself. And in order not to process duplicate messages on the server (in case socketIO does resend a message after an interrupted connection), you could include a timestamp and an expiry date in the message. |
Hi, I couldn't find an answer to this in the docs.
So when I switch off internet on my phone, emit a message and then turn internet back on (after a couple of seconds), the message is sent to the server. If I switch it off and wait longer before turining it back on, the message is not emitted. So does some event (Socket.EVENT_CONNECTION_ERROR, Socket_EVENT_DISCONNECT, ...) mean that retrying to emit the message is stopped?
The text was updated successfully, but these errors were encountered: