How to unsubscribe from a socket.io subscription?

前端 未结 11 1343
长发绾君心
长发绾君心 2020-11-30 02:00

Suppose there are objects making subscriptions to a socket server like so:

socket.on(\'news\', obj.socketEvent)

These objects have a short life

11条回答
  •  心在旅途
    2020-11-30 02:26

    Removing an event listener on the client

    var Socket = io.connect();
    Socket.removeListener('test', test);
    

提交回复
热议问题