If our server maintains a list of our connected sockets, it should always be mindful of when a socket disconnects.
A socket can disconnect for any number of reasons:
When these things happen, we can tap into the
disconnect event to notify the client side that the socket is no longer available.
To remove references from disconnected sockets, follow these steps:
disconnectevent on the server side. When this occurs, we will emit an event back to the clients with the ID of the socket that was disconnected. Socket.IO associates every socket with a unique ID, which we can ...