Skip to content

Instantly share code, notes, and snippets.

@ThisIsMissEm
Forked from cgcardona/gist:525766
Created August 15, 2010 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThisIsMissEm/525776 to your computer and use it in GitHub Desktop.
Save ThisIsMissEm/525776 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>
<%= title %>
</title>
<link href="//fonts.googleapis.com/css?family=Yanone+Kaffeesatz:200,300,400,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="/stylesheets/generic.css" type="text/css" />
<link rel="stylesheet" href="/stylesheets/visualize.css" type="text/css" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="/javascripts/visualize.jQuery.js" ></script>
</head>
<body>
<a href="http://github.com/cgcardona/StatSocket">
<img src="/images/forkthis.png" id="ribbon" alt="Fork this code on Github">
</a>
<div id="header">
<h1>
StatSocket
</h1>
<h2>
Real Time Web Analytics Using HTML5 WebSockets &amp; node.js
</h2>
</div>
<div id="container">
<div class="buttons1">
<a href="#" id="send" class="orange-button">Send Something</a>
<a href="#" class="orange-button" id="spam">Spam Test</a>
<a href="#" id="close" class="blue-button">Close Connection</a>
<a href="#" id="open" class="orange-button">Open Connection</a>
</div><!--end of buttons1 div-->
</div>
<div id="info">
<p>
<a href="http://dev.w3.org/html5/websockets/">WebSockets</a> enable Web Pages to have two-way communication with a remote host. StatSocket is an HTML5 tool that allows you to see real time stats on your site.
</p>
<div id="log"></div>
</div><!--end of info div-->
<script type="text/javascript">
var conn
, connect = function(app) {
if (window["WebSocket"]) {
conn = new WebSocket("ws://localhost:8000/analytics");
conn.onmessage = function(evt) {
app.onMessage(evt.data);
};
conn.onclose = function() {
app.onClose();
};
conn.onopen = function() {
app.onOpen();
};
}
};
var App = {
onOpen: function(){},
onClose: function(){},
onMessage: function(){},
};
$(function(){
connect(App);
$('table').visualize()
// $("*").click(function() {
// $.ajax({
// type: "POST",
// url: "/stats",
// data: {
// clacked: $(this).attr("class")
// },
// success: function() {
// // highlight animate or something cool
// }
// })
// })
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment