Skip to content

Instantly share code, notes, and snippets.

@toastdriven
Created August 15, 2010 05:17
Show Gist options
  • Select an option

  • Save toastdriven/525114 to your computer and use it in GitHub Desktop.

Select an option

Save toastdriven/525114 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>Commits</title>
<script src="socket.io.js"></script>
</head>
<body>
<script>
io.setPath('/client/');
function message(obj){
console.log(obj);
for(var commit_offset in obj) {
var commit = obj[commit_offset];
var el = document.createElement('p');
el.innerHTML = ""+commit.team_name+" - "+commit.member_name+" commited "+commit.revision.slice(0,6)+".";
document.getElementById('commits').appendChild(el);
document.getElementById('commits').scrollTop = 1000000;
}
}
var socket = new io.Socket("localhost", {port: 8080});
socket.connect();
socket.on('message', function(data){
var obj = JSON.parse(data);
message(obj);
});
socket.send('');
</script>
<h1>Commits</h1>
<div id="commits"><p>Connecting...</p></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment