(topic: string, event: string, payload: Record<string, any>)
| 62 | } |
| 63 | |
| 64 | private send(topic: string, event: string, payload: Record<string, any>) { |
| 65 | const message = JSON.stringify([topic, event, payload]); |
| 66 | |
| 67 | if (this.socket && this.open) { |
| 68 | this.socket.send(message); |
| 69 | } else { |
| 70 | console.error( |
| 71 | `Attempting to send a message to a socket with readyState '${this.humanReadyState()}'. This is a bug in WebSocketClient.\n\nMessage:\n${message}`, |
| 72 | ); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | private humanReadyState() { |
| 77 | switch (this.socket?.readyState) { |
no test coverage detected