From d43796bec575c0c921f2cf11f783a9b6928c302b Mon Sep 17 00:00:00 2001 From: Oscar Brito Date: Thu, 29 Oct 2020 14:29:53 +0000 Subject: [PATCH] review --- docs/WebSocketServer.md | 6 ++++-- lib/WebSocketServer.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/WebSocketServer.md b/docs/WebSocketServer.md index 747c5f7f..e0ea60c6 100644 --- a/docs/WebSocketServer.md +++ b/docs/WebSocketServer.md @@ -110,5 +110,7 @@ Emitted whenever a new WebSocket connection is accepted. Whenever a connection is closed for any reason, the WebSocketServer instance will emit a `close` event, passing a reference to the WebSocketConnection instance that was closed. `closeReason` is the numeric reason status code for the connection closure, and `description` is a textual description of the close reason, if available. -### close -`function(webSocketConnection, closeReason, description)` +### upgradeError +`function(error)` + +Emitted whenever a WebSocket error happens during the connection upgrade phase. Note that the WS connection is automatically rejected with a 400 error code, this event just exposes the error. diff --git a/lib/WebSocketServer.js b/lib/WebSocketServer.js index 4820fda1..2b25d463 100644 --- a/lib/WebSocketServer.js +++ b/lib/WebSocketServer.js @@ -208,7 +208,7 @@ WebSocketServer.prototype.handleUpgrade = function(request, socket) { e.headers ); debug('Invalid handshake: %s', e.message); - this.emit('handshakeError', e); + this.emit('upgradeError', e); return; }