In socket.io, when the client is disconnected from the server the disconnect
event is fired in the server for the socket. Do I have to removeAllEventListeners()
from the socket $events
? Or does it happen automatically when the socket dies? I heard that memory leaks can be on the server if i don't do it ...
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.