mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-07-23 04:17:15 +02:00
message browser to client working
This commit is contained in:
@ -2,26 +2,21 @@
|
||||
<head>
|
||||
|
||||
<script>
|
||||
var connection = new WebSocket('ws://10.11.2.1:81/test', ['esp8266']);
|
||||
|
||||
|
||||
var connection = new WebSocket('ws://10.11.2.1:81/test', ['esp8266', 'test']);
|
||||
|
||||
// When the connection is open, send some data to the server
|
||||
connection.onopen = function () {
|
||||
connection.send('ping'); // Send the message 'Ping' to the server
|
||||
connection.send('Message from Browser to ESP8266 yay its Working!!');
|
||||
connection.send('ping');
|
||||
};
|
||||
|
||||
// Log errors
|
||||
connection.onerror = function (error) {
|
||||
console.log('WebSocket Error ' + error);
|
||||
console.log('WebSocket Error ', error);
|
||||
};
|
||||
|
||||
// Log messages from the server
|
||||
connection.onmessage = function (e) {
|
||||
console.log('Server: ' + e.data);
|
||||
console.log('Server: ', e.data);
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
Reference in New Issue
Block a user