J
J
jsonuser2020-11-24 05:15:43
Node.js
jsonuser, 2020-11-24 05:15:43

Why doesn't the disconnect event from socket.io come after the internet is disconnected?

After the user disconnects the Internet, the disconnect event does not come to the server, what should I do?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2020-11-24
@HistoryART

The session is still alive, it will live the time you set or the standard time and then die, then the disconnect will occur.

R
rPman, 2020-11-24
@rPman

A break in the network while the connection is open is a normal state in tcp / ip, it’s perfectly normal to open an ssh connection to the server, pull the wire out of the router, insert it in a dozen other minutes - and everything will work, even errors will not pop up (until you try to send a packet to disconnect time). This is why they came up with various timeouts ,
and socket.io itself also sends pings
periodically

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question