Commit 7ea3ba64ea381613535ab28776a9fcb162a575b9

Authored by Claire Vandamme
1 parent 5f7d5a55

transmission des messages de l'application web à la raspberry v …

…                                                                                               ia web socket
Showing 1 changed file with 6 additions and 3 deletions   Show diff stats
pageHTML/Menu.html
@@ -9,14 +9,17 @@ @@ -9,14 +9,17 @@
9 websocket.onerror=function(){ $('h1').css('color','red');}; 9 websocket.onerror=function(){ $('h1').css('color','red');};
10 websocket.onopen=function(){ $('h1').css('color','green');}; 10 websocket.onopen=function(){ $('h1').css('color','green');};
11 11
  12 +
12 webscket.onmessage=function(message){ 13 webscket.onmessage=function(message){
13 console.log(message.data); 14 console.log(message.data);
14 $('#messages').append($('<p>',{ text: message.data})); 15 $('#messages').append($('<p>',{ text: message.data}));
15 }; 16 };
16 17
17 - function sendMessage(){  
18 - websocket.send($('#message').val());  
19 - $('message').val(''); 18 + function etat(){
  19 + var message=$('#myonoffswitch').checked;
  20 + websocket.send(message);
  21 + }
  22 +
20 } 23 }
21 </script> 24 </script>
22 25