diff --git a/lib/WebSocketRequest.js b/lib/WebSocketRequest.js index f4d96555..9a101115 100644 --- a/lib/WebSocketRequest.js +++ b/lib/WebSocketRequest.js @@ -447,6 +447,8 @@ WebSocketRequest.prototype.accept = function(acceptedProtocol, allowedOrigin, co cleanupFailedConnection(connection); } else { + // Avoid EPIPE error to break execution. Error is detected in callback + this.socket.on ('error', function (err) {}); this.socket.write(response, 'ascii', function(error) { if (error) { cleanupFailedConnection(connection);