I have this wrapper for socket.io:
on: function (eventName, callback) {
console.log('socket on hit');
socket.on(eventName, function () {
var args = arguments;
$rootScope.$apply(function () {
callback.apply(socket, args);
});
});
//removes duplicate listener
// console.log('about to remove a listener') ;
socket.removeListener(eventName, callback);
}
This leaves me with duplicate listeners over time.
This is still an issue. When I use removeListener, it doesn't remove the event but using removeAllListeners works.
+1 only removeAllListeners is working properly
We still facing the same issue more than 2 years later. I think remove a single listener should be something basic.
any solution to this yet?
Most helpful comment
We still facing the same issue more than 2 years later. I think remove a single listener should be something basic.