Answer the question
In order to leave comments, you need to log in
How to keep socket.io connection?
When the page is reloaded, the user is always disconnected first, then connected, respectively, this is not very beautiful for the list of online users, they will constantly blink in the list, how can I keep the connection while the page is reloaded? Or how to close the connection if the user is inactive for more than 5 minutes?
Answer the question
In order to leave comments, you need to log in
Save the state in localStorage and compare with it when loading the page, if the state has not changed, then do not change anything, otherwise, disable only what has changed
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question