Fix for update to ws@5.2.0 module.

This commit is contained in:
Marco Tundo 2018-07-12 14:40:34 -04:00 committed by Jairo Caro-Accino Viciana
parent 9c789f96b5
commit 19d6380927

View File

@ -20,12 +20,12 @@ app._initializeWSS = function(server) {
// Create WebSocket server as well.
this._wss = new WebSocketServer({ path: path, server: server});
this._wss.on('connection', function(socket) {
var query = url.parse(socket.upgradeReq.url, true).query;
this._wss.on('connection', function(socket, req) {
var query = url.parse(req.url, true).query;
var id = query.id;
var token = query.token;
var key = query.key;
var ip = socket.upgradeReq.socket.remoteAddress;
var ip = req.socket.remoteAddress;
if (!id || !token || !key) {
socket.send(JSON.stringify({ type: 'ERROR', payload: { msg: 'No id, token, or key supplied to websocket server' } }));