Skip to content

Conversation

netop
Copy link

@netop netop commented May 18, 2017

Update server.js due to [email protected] Breaking changes that removes the upgradeReq from the WebSocket
object

websockets/ws#1099
websockets/ws#1104

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;
Copy link

@lpinca lpinca May 18, 2017

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.

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants