16

在 socket.io 中,当客户端与服务器断开连接时,disconnect会在服务器中为套接字触发事件。我必须removeAllEventListeners()从插座$events吗?或者当套接字死亡时它会自动发生吗?我听说如果我不这样做,内存泄漏可能会出现在服务器上......

4

1 回答 1

20

After digging through the socket.io source, the socket object (which is the EventEmitter) is deleted when the client disconnects so it is not necessary to manually call removeAllListeners.

于 2012-11-28T04:41:57.910 回答