Answers for "create a socket connection to api server"

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

Code answers related to "create a socket connection to api server"

Code answers related to "Javascript"

Browse Popular Code Answers by Language