Skip to content

Commit

Permalink
[fix] ensure handleUpgrade doesn't break if socket is just a stream
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Aug 30, 2023
1 parent 347aab6 commit d2cf8cf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ class WebSocket extends EventEmitter {
receiver.on('pong', receiverOnPong);

socket.setTimeout(0);
socket.setNoDelay();
if (socket.setNoDelay) {
// May not be available if 'socket' is actually a stream
socket.setNoDelay();
}

if (head.length > 0) socket.unshift(head);

Expand Down

0 comments on commit d2cf8cf

Please sign in to comment.