Şöyle yaparız
constructor - subprotocol// Create a new WebSocketlet socketConnection = new WebSocket('ws://websocket.mysite.com');
Şöyle yaparız
onX metodu// Create a new WebSocket with subprotocolslet socketConnection = new WebSocket('ws://websocket.mysite.com', ['soap', 'xmpp']);
Şöyle yaparız
// When the connection is open, some data is sent to the serversocketConnection.onopen = function () {connection.send('Hello, the socket connection is open!'); // Send a message to the server};// Log errorssocketConnection.onerror = function (error) {console.log('WebSocket Error ' + error);};// Log messages from the serversocketConnection.onmessage = function (e) {console.log('Server: ' + e.data);};
Hiç yorum yok:
Yorum Gönder