Created
March 9, 2011 14:57
-
-
Save dahernan/862331 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> | |
<script type="text/javascript" src="https://github.com/joewalnes/smoothie/raw/master/smoothie.js"></script> | |
<script src="http://localhost:8080/socket.io/socket.io.js"></script> | |
<div> | |
<p>Node.js Rabbitmq Websockets Canvan Smoothie Groovy</p> | |
<canvas id="mycanvas" width="800" height="300"> | |
</canvas> | |
</div> | |
<script> | |
// canvas html5 | |
var smoothie = new SmoothieChart(); | |
smoothie.streamTo(document.getElementById("mycanvas"),1000); | |
var line1 = new TimeSeries(); | |
// Add to SmoothieChart | |
smoothie.addTimeSeries(line1, { strokeStyle:'rgb(0, 255, 0)', fillStyle:'rgba(0, 255, 0, 0.4)', lineWidth:3 }); | |
var socket = new io.Socket("localhost", {port: 8080, rememberTransport: false}); | |
socket.connect(); | |
socket.on('connect', function(){ }) | |
socket.on('message', function(message){ line1.append(new Date().getTime(),parseFloat( message.message));}) | |
socket.on('disconnect', function(){ }) | |
socket.send("Hello socket world"); | |
</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment