We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e82ecb9 commit c6fd38bCopy full SHA for c6fd38b
src/http/sender.js
@@ -411,8 +411,14 @@ class Sender {
411
*/
412
sendFrame(list, cb) {
413
if (list.length === 2) {
414
- this._socket.write(list[0]);
415
- this._socket.write(list[1], cb);
+ // The WebSocket frame is in two chunks. Merge the two byte arrays into a single byte array,
+ // and transmit in a single write (to prevent the receiving side from potentially processing
416
+ // a partial frame)
417
+ var mergedArray = new Uint8Array(list[0].length + list[1].length);
418
+ mergedArray.set(list[0]);
419
+ mergedArray.set(list[1], list[0].length);
420
+ this._socket.write(mergedArray, cb);
421
+
422
} else {
423
this._socket.write(list[0], cb);
424
}
0 commit comments