Ejemplo 1: código de ejemplo javascript websocket
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
Ejemplo 2: js se conecta a websocket
var exampleSocket = new WebSocket("wss://www.example.com/socketserver", "protocolOne");
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)