/**
* @date 2015-12-07
**/
document.write( "Creating web socket ...
\n" )
var connection = new WebSocket('ws://int2byte.de/public/websocket/echo.php', ['soap', 'xmpp']);
// When the connection is open, send some data to the server
connection.onopen = function () {
document.write( "Sending ping ...
\n" );
connection.send('Ping'); // Send the message 'Ping' to the server
};
// Log errors
connection.onerror = function (error) {
console.log('WebSocket Error ' + error);
};
// Log messages from the server
connection.onmessage = function (e) {
console.log('Server: ' + e.data);
};