Usually, we only put the data we want to send as websocket.send() method’s parameter, but I want to know whether there are other parameters like IP that we can put inside the brackets. Can we use it this way:
websocket.send(ip, data); // send data to this ip address
Or I should call other methods?
As I understand it, you want the server be able to send messages through from client 1 to client 2. You cannot directly connect two clients because one of the two ends of a WebSocket connection needs to be a server.
This is some pseudocodish JavaScript:
Client:
Server: