I built a simple clientside logger which prints all current active socket.io listeners on my page. I'm getting this information directly from the socket object and the inner $events object.
The $events object looks like this for example in chrome:
$events: Object
news: function (data) {
__proto__: Object
But when the listener for the event is removed with socket.removeAllListeners('news') then it looks like this:
$events: Object
news: null
__proto__: Object
The attributes stays but gets null as value. Why is it not deleted completely?
When you use socket.once() and get the one emit from the server or when you delete the concrete listener directly with socket.removeListener() the attribute gets deleted and it looks like this:
$events: Object
__proto__: Object
I would really like to know why it is behaving this way. Is it still listening for the events with null as value but without calling any function?