I am setting websocket handlers on native websocket created with new WebSocket()
using ws.onopen = myFunc;
How would I remove that event handler when I no longer need it?
I am not in a position to use socket.io
I am setting websocket handlers on native websocket created with new WebSocket()
using ws.onopen = myFunc;
How would I remove that event handler when I no longer need it?
I am not in a position to use socket.io
Just set it back to its initial value, undefined
, or to null
:
ws.onopen = null;