If you only have one of a listener, or you want to remove all listeners for an event, you can use
socket.off("event")
but if you want to be super specific you'll have to save the UUID that's returned from on
let uuid = socket.on("event", someHandler)
socket.off(id: uuid)
thanks nuclearace it helped me......
This answer did not work for me! Instead I did this (and it worked!):
socket.on("event" , someHandler);
socket.removeListener("event", someHandler);
Thanks @tomergev
it worked out well for me!
Most helpful comment
If you only have one of a listener, or you want to remove all listeners for an event, you can use
but if you want to be super specific you'll have to save the UUID that's returned from
on