A
A
Alexander Ivanov2019-05-17 06:28:39
JavaScript
Alexander Ivanov, 2019-05-17 06:28:39

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

1 answer(s)
S
Shohruh Shaimardonov, 2019-05-17
@joeberetta

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 question

Ask a Question

731 491 924 answers to any question