Open youaresherlock opened 5 years ago
The remote address should be available via the conn.socket.remoteAddress
property. For example:
const ws = require('nodejs-websocket');
const LISTEN_ADDRESS = '0.0.0.0';
const LISTEN_PORT = 8080;
let server = ws.createServer(function(conn) {
let rAddr = conn.socket.remoteAddress;
let rPort = conn.socket.remotePort;
console.log(`New connection from ${rAddr}:${rPort}`);
}).listen(LISTEN_PORT, LISTEN_ADDRESS);
how can a server get the ip address from the client?