Anton Ch
Anton Ch

Reputation: 27

Establish Websocket connection by client IP address

How can my Websocket server initiate a connection to a client choosing it by its IP address? I have multiple clients each one having static IP. The list of expected IPs is stored on the Server side. I would expect something like (demo code):

const webSocket = require('ws');
const ip = "111.111.111.111";
const ws = new webSocket(ip);
ws.on('open', () => {
    console.log(`Connected to client at ${ip}`);
});

Upvotes: 0

Views: 65

Answers (0)

Related Questions