I am developing an online game using socket.io. Node.js in server side and JavaScript on client side. Everything works well but when the client goes offline and comeback online the events are not send to the client. Inside the server is there any sendBuffer for each client ?
To see the exact problem we can use simple chat-example provided by the socket.io team : https://github.com/socketio/chat-example
Here if a client send a message while offline will be send when it reconnects to the server. But if a client is offline while server send a message(forwarded from another client) client will not receive on re-connection.
So how should I solve this issue properly ?
socket.io : v4
OS : Ubuntu 22.04
2
Answers
Sorry! It's well documented here : https://socket.io/docs/v4/delivery-guarantees
You still need to store the information on the server in case of such situations.
You can use timeouts
https://socket.io/docs/v4/emit-cheatsheet/#server-side