I have a web based multiplayer game. It happens from time to time that someone is kicked out because server did not get expected message from client. It seems from my logs that client did not disconnect, just did not send message or server did not receive it. My question here is "Does this things happen normally from time to time?" Should i use some kind of callback mechanism to ensure message is delivered and if not send it again or is there some issue that i am not aware?
Asked
Active
Viewed 1,419 times
3
-
Related [**Reliable messaging under socket.io?**](http://stackoverflow.com/questions/9578134/reliable-messaging-under-socket-io/15590367#15590367) – Benjamin Gruenbaum Jul 27 '13 at 21:09
-
@BenjaminGruenbaum thank you for this great post. But that is related to disconnecting and for my problem connection is not broken (web socket). It seems that sometimes socket.io fails to send message successfuly... – Dusan Radojevic Jul 27 '13 at 21:16
-
Which is why I said it is related and upvoted this question instead of nominating this question for closing, a related post and a duplicate are two very different things :) It's a different question, the subject itself is related. The point was - there is no reliable way to ensure a message delivery was successful. I'm sure someone with more practical socket.io advice will come along and suggest practical strategies to deal with the issue in your case. The 'callback mechanism' you speak of does not _really_ exist in the sense you mean. Anyway, I'll keep track of answers here, and good luck! – Benjamin Gruenbaum Jul 27 '13 at 21:21
-
1sockets.io uses TCP, so packet loss "should" never happen. But if the messages are being sent over the Internet, occasional packet loss could still occur. It could also be a bug in your network code that is preventing the client from sending the appropriate message. – Michael Jul 27 '13 at 21:49
1 Answers
0
socket.io already provides ACKs and message ID tracking, on top of TCP.
Also, socket.io uses pings to check the connection. So, if you say that the client is not disconnected, and the server tells that the client is not disconnected, then the connection is still there.
The problem must be situated elsewhere.
Are you sure there is not a bug in either part of the implementation? Showing some code snippets could help, as well as the environment you are using.

Kurt Pattyn
- 2,758
- 2
- 30
- 42