Closed bioinfo35 closed 6 years ago
Update ws
to version 3.0.0 or greater.
i am using ws v 4.0 here is screenshot https://www.screencast.com/t/ESZdbNg5 i tested it on windows and ubuntu
npm info
queries the public registry, so you get the latest version.
Run npm ls ws
from the root of your project to find out what version of ws
you are actually using.
If you are on ws@<3.0.0
, use ws.upgradeReq
instead of req
.
Thank You @lpinca
const WebSocket = require('ws');
const wsss = new WebSocket.Server({ port: 2000 });
wsss.on('connection', function connection(ws, req) { console.log(req); const ip = req.connection.remoteAddress; });
i get
req
is not definedDescription
Reproducible in:
version: Node.js version(s): OS version(s):
Steps to reproduce:
1. 2. 3.
Expected result:
Actual result:
Attachments: