0

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

Halcyon
  • 1,376
  • 1
  • 15
  • 22

1 Answers1

2

Just set it back to its initial value, undefined, or to null:

ws.onopen = null;
Bergi
  • 630,263
  • 148
  • 957
  • 1,375