* Send data over the WebSocket
(data: Uint8Array)
| 107 | * Send data over the WebSocket |
| 108 | */ |
| 109 | send(data: Uint8Array): void { |
| 110 | if (!this.ws || this.state !== 'connected') { |
| 111 | throw new Error('WebSocket is not connected'); |
| 112 | } |
| 113 | |
| 114 | this.ws.send(data); |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Register an event handler |