From a5152a6b99244c9bf851f552983a2771e140071b Mon Sep 17 00:00:00 2001 From: Yuliy Pisetsky Date: Fri, 29 Sep 2023 19:07:29 -0700 Subject: [PATCH] support websocket raw length --- Libraries/WebSocket/WebSocket.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Libraries/WebSocket/WebSocket.js b/Libraries/WebSocket/WebSocket.js index 3fdde2b3639adf..c544e185ecd129 100644 --- a/Libraries/WebSocket/WebSocket.js +++ b/Libraries/WebSocket/WebSocket.js @@ -245,7 +245,12 @@ class WebSocket extends (EventTarget(...WEBSOCKET_EVENTS): any) { data = BlobManager.createFromOptions(ev.data); break; } - this.dispatchEvent(new WebSocketEvent('message', {data})); + const raw_length = ev.raw_length; + if (raw_length == null) { + this.dispatchEvent(new WebSocketEvent('message', {data})); + } else { + this.dispatchEvent(new WebSocketEvent('message', {data, raw_length})); + } }), this._eventEmitter.addListener('websocketOpen', ev => { if (ev.id !== this._socketId) {