(data: string | ArrayBuffer | $ArrayBufferView)
| 98 | } |
| 99 | |
| 100 | send(data: string | ArrayBuffer | $ArrayBufferView): void { |
| 101 | if (this.readyState === this.CONNECTING) { |
| 102 | throw new Error('INVALID_STATE_ERR'); |
| 103 | } |
| 104 | |
| 105 | if (typeof data === 'string') { |
| 106 | RCTWebSocketModule.send(data, this._socketId); |
| 107 | return; |
| 108 | } |
| 109 | |
| 110 | if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) { |
| 111 | RCTWebSocketModule.sendBinary(binaryToBase64(data), this._socketId); |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | throw new Error('Unsupported data type'); |
| 116 | } |
| 117 | |
| 118 | ping(): void { |
| 119 | if (this.readyState === this.CONNECTING) { |
no test coverage detected