Minimal Events for WebSockets.
ws-events decorates a WebSocket instance. It works both on the server and the
On the server side:
const wsEvents =const Server = Serverconst wss =wss
On the client side:
const wsEvents =const ws =ws
ws-events emitter. The emitter wraps the passed-in socket, so all
native WebSocket methods can still be used.
socket is a standard WebSocket instance.
const socket =socket
Register an event handler.
Remove an event handler.
Remove all handlers for the given event.
Remove all handlers for all events.
Emit an event. When emitting on the server, the handlers on the client will fire. When emitting on the client, the handlers on the server will fire.
Check if there are any handlers for an event.
Return the listeners for an event.