Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
socket.ioでは、クライアントがサーバーから切断されるdisconnectと、ソケットのサーバーでイベントが発生します。removeAllEventListeners()ソケットからする必要があります$eventsか?それとも、ソケットが死んだときに自動的に発生しますか?私がそれをしなければ、メモリリークがサーバー上にある可能性があると聞きました...
disconnect
removeAllEventListeners()
$events
socket.ioソースを掘り下げた後、クライアントが切断するとソケットオブジェクト(EventEmitter)が削除されるため、removeAllListenersを手動で呼び出す必要はありません。