Mbed websocket
From emboxit
mbed websocket project
Websocket and mbed
- This javascript saved as .html and opened with browser,
- Gives customized access to sockets.mbed.org server
- For Firefox Moz prefix is needed (...check code to locate it)
- Firefox still does not work with sockets.mbed.org/[...]/viewer or sender
- For Chrome and Chromium without the Moz prefix
- File:1.7z is working for Firefox
- In line 24 Moz Prefix is added 500px
<!doctype html> <html> <head> <style type="text/css"> body { text-align: center; min-width: 500px; } </style> <script src="http://code.jquery.com/jquery.min.js"></script> <script> function log(m) { d = document.getElementById("log"); d.innerHTML = m + "<br/>" + d.innerHTML; } $(document).ready(function () { $("#open").click(function(evt) { evt.preventDefault(); var channel = $("#channel").val(); var ws = new MozWebSocket("ws://sockets.mbed.org/ws/" + $("#channel").val() + "/rw"); ws.onopen = function(evt) { $("#channel").css("background", "#00ff00"); document.getElementById("title").innerHTML = "Websockets streaming on channel: " + $("#channel").val(); }; ws.onmessage = function(evt) { log("message: " + evt.data); }; ws.onclose = function(evt) { log("socket closed"); }; }); }); </script> </head> <body> <h1 id="title">Websockets Streaming</h1> <label for="channel">channel:</label> <input type="text" id="channel" style="background:#ff0000;"/><br /> <input type="submit" id="open" value="open" /> <div id="log"></div> </body> </html>
- http://mbed.org/blog/entry/HTML5-for-Microcontrollers/
- http://mbed.org/users/samux/notebook/websocket/
- http://mbed.org/cookbook/Websockets-Server
- http://mbed.org/cookbook/IOT
- http://mbed.org/cookbook/RPC-over-Websockets