I use socket.io to connect a smartphone (in a web frame) to the server and send a few messages around (a few short lines per minute, nothing big). Since smartphones often have an unstable connection, socket.io is forced to reconnect from time to time. It does this automatically, and the messages that I want to send after they notice that the connection is currently unavailable are buffered and sent as a packet after reconnecting. So basically everything is going well with socket.io.
But when I send a message right before socket.io notices that the connection is gone, the message is lost. It cannot be transmitted, but it does not receive socket.io buffering. I am quite happy with the .io socket, but this problem causes me since I do not send many messages, but I really need the ones that I send for sending, reliably. While the connection is established, all messages are transmitted perfectly, so I do not need to check this. Only the second between the loss of connection and socket.io notices that this is a critical moment when I encounter packet loss.
I was thinking about how to simulate the behavior of TCP with serial numbers and ACK, but it is a bit like shooting ants with a rocket launcher. So my question is: does anyone have an easy solution to this problem, or even comes across this myself? I donโt even ask for explicit code - I can do it myself, but a concept or something like that to get rid of this particular problem would be great.
Thanks in advance!
Jens neumann
source share