Answer the question
In order to leave comments, you need to log in
How to implement connection resumption in socket.io?
In online games such as agar.io, when the internet connection is cut off and then resumed within a short period of time, the client continues from the same place where he left off. On the server, I am using socket.io.
io.on("connection",function (socket) {
console.log("Player "+socket.id+" connected");
});
The problem is that when reconnecting, the server creates another connection with a new socket and id. The question is how to find out that the same client is connected that disconnected a couple of seconds ago? I thought to store on the client the id of the first connection, which is transferred to the server. Is this the normal approach? Maybe you can resume the session automatically?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question