On Fri, Nov 16, 2012 at 3:37 PM, Chad Engler <
Chad....@patlive.com>
wrote:
> Remove your listeners when they disconnect.
Er, yes! But somehow it didn't occur to me to simply do sth. like:
socket.once('disconnect', function () {
// clean up and remove listeners
}
Instead I tried listening to `disconnect` as emitted by `io.sockets`,
but that doesn't make much sense.
One thing to be aware of (as a note to myself): A client may disconnect
because the network connection is interrupted. If the network connection
comes back on, the client will connect again, and then server-side event
listeners have to be set up again.
By the way, I am wondering whether I have to manually take care of
removing the listeners to events emitted by `socket`
(set up with `socket.on(listener)`). Clarification would be helpful.