Reputation: 219
How get IP address before connecting on server client (use websockets/ws)?
var webSocketServer = new WebSocketServer.Server({port: 8081, verifyClient: function(info, callback) { });
Upvotes: 0
Views: 1595
Reputation: 708016
You can't get the IP address of a client before it connects. Before the connection, there is no contact at all between client and server and thus the server has no idea which client will connect some time in the future. It would literally be any client in the world.
If you explain what you're really trying to accomplish we might be able to help you solve your problem better.
Upvotes: 2
Reputation: 939
I assume you are looking for client's IP address. One of the ways to get it
websocket._socket.remoteAddress
Upvotes: 0