MCPcopy Create free account
hub / github.com/ptmt/react-native-macos / send

Method send

Libraries/WebSocket/WebSocket.js:100–116  ·  view source on GitHub ↗
(data: string | ArrayBuffer | $ArrayBufferView)

Source from the content-addressed store, hash-verified

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) {

Callers 15

handleSendBroadcastFunction · 0.45
handleCaughtErrorFunction · 0.45
handleServerRequestFunction · 0.45
forwardRequestFunction · 0.45
forwardResponseFunction · 0.45
sendFunction · 0.45
_sendMethod · 0.45
_handleWrappedEventMethod · 0.45
attachHMRServerFunction · 0.45
sendRequestMethod · 0.45
sendNotificationMethod · 0.45

Calls 2

binaryToBase64Function · 0.85
sendBinaryMethod · 0.45

Tested by

no test coverage detected