2015-05-22 14:19:01 +02:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
|
|
|
|
<script>
|
2015-05-22 20:35:51 +02:00
|
|
|
var connection = new WebSocket('ws://10.11.2.1:81/test', ['esp8266']);
|
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
|
|
|
};
|
|
|
|
|
2015-05-22 23:02:47 +02:00
|
|
|
setInterval(function() {
|
2015-05-23 09:57:11 +02:00
|
|
|
connection.send('Message from Browser to ESP8266 yay its Working!! ' + new Date());
|
2015-05-22 23:02:47 +02:00
|
|
|
}, 10000);
|
|
|
|
|
2015-05-22 14:19:01 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
Test Websocket.
|
|
|
|
</body>
|
|
|
|
</html>
|