Answers for "Create a web socket and listen for change in chat Send chat message to socket so that only specific person can listen"

6

javascript websocket example code

var Socket = new WebSocket('ws://' + window.location.hostname + ':81/'); // The '81' here is the Port where the WebSocket server will communicate with
// The instance of the WebSocket() class (i.e. Socket here), must need to be globally defined

Socket.send("pass your data here, and it'll be String"); // This method one can call locally
Posted by: Guest on May-31-2020
3

js connect to websocket

var exampleSocket = new WebSocket("wss://www.example.com/socketserver", "protocolOne");
Posted by: Guest on February-22-2020

Code answers related to "Create a web socket and listen for change in chat Send chat message to socket so that only specific person can listen"

Code answers related to "Javascript"

Browse Popular Code Answers by Language