-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update server.js to fix [email protected] breaking changes #1
base: master
Are you sure you want to change the base?
Conversation
@@ -20,7 +20,8 @@ app._initializeWSS = function(server) { | |||
// Create WebSocket server as well. | |||
this._wss = new WebSocketServer({ path: path, server: server}); | |||
|
|||
this._wss.on('connection', function(socket) { | |||
this._wss.on('connection', function(socket, req) { | |||
socket.upgradeReq = req; | |||
var query = url.parse(socket.upgradeReq.url, true).query; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the only place where upgradeReq
is used it is probably better to use:
var query = url.parse(req ? req.url : socket.upgradeReq.url, true).query;
and remove the previous line. This will work with all ws
versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the ws
dependency version to 3.0.0 as well.
Thanks.
Update server.js due to [email protected] Breaking changes that removes the
upgradeReq
from theWebSocket
object
websockets/ws#1099
websockets/ws#1104