Files
arduinoWebSockets/tests/webSocket.html
T

30 lines
571 B
HTML
Raw Normal View History

2015-05-22 14:19:01 +02:00
<html>
<head>
<script>
2015-07-15 10:09:07 +02:00
var connection = new WebSocket('ws://10.11.2.2:81/test', ['arduino']);
2015-05-22 14:19:01 +02:00
connection.onopen = function () {
2015-05-23 09:57:11 +02:00
connection.send('Message from Browser to ESP8266 yay its Working!! ' + new Date());
2015-05-22 20:35:51 +02:00
connection.send('ping');
2015-05-22 14:19:01 +02:00
};
connection.onerror = function (error) {
2015-05-22 20:35:51 +02:00
console.log('WebSocket Error ', error);
2015-05-22 14:19:01 +02:00
};
connection.onmessage = function (e) {
2015-05-22 20:35:51 +02:00
console.log('Server: ', e.data);
2015-05-22 14:19:01 +02:00
};
setInterval(function() {
2015-05-24 15:40:47 +02:00
connection.send('Time: ' + new Date());
}, 1000);
2015-05-22 14:19:01 +02:00
</script>
</head>
<body>
Test Websocket.
</body>
</html>