(message: unknown)
| 706 | } |
| 707 | |
| 708 | public send(message: unknown): void { |
| 709 | if (this.closed) return; |
| 710 | if (this.socket.readyState !== this.socket.OPEN) return; |
| 711 | try { |
| 712 | this.socket.send(JSON.stringify(message), (err) => { |
| 713 | if (err) this.logger.warn({ err: String(err) }, 'ws send failed'); |
| 714 | }); |
| 715 | } catch (err) { |
| 716 | this.logger.warn({ err: String(err) }, 'ws send threw'); |
| 717 | } |
| 718 | } |
| 719 | |
| 720 | public close(code = 1000, reason?: string): void { |
| 721 | if (this.closed) return; |
no test coverage detected