From 8c28f025b4655d45e09223f9e3e29881f257987b Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Fri, 23 Jun 2017 15:51:27 -0700 Subject: [PATCH] Fixes for ws@3 --- server.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index 419073b..2636242 100644 --- a/server.js +++ b/server.js @@ -127,7 +127,12 @@ function Server (opts) { return self.http.address() } self.ws.on('error', function (err) { self._onError(err) }) - self.ws.on('connection', function (socket) { self.onWebSocketConnection(socket) }) + self.ws.on('connection', function (socket, req) { + // Note: socket.upgradeReq was removed in ws@3.0.0, so re-add it. + // https://github.com/websockets/ws/pull/1099 + socket.upgradeReq = req + self.onWebSocketConnection(socket) + }) } if (opts.stats !== false) {