فهرست منبع

Fix for update to ws@5.2.0 module.

Marco Tundo 6 سال پیش
والد
کامیت
19d6380927
1فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 3 3
      lib/server.js

+ 3 - 3
lib/server.js

@@ -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' } }));