Skip to content

Instantly share code, notes, and snippets.

@maurodoglio
Created December 20, 2013 17:11
Show Gist options
  • Save maurodoglio/8058063 to your computer and use it in GitHub Desktop.
Save maurodoglio/8058063 to your computer and use it in GitHub Desktop.
treeherder socketio client example
<!DOCTYPE html>
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"></script>
<script>
// Create SocketIO instance, connect
var socket = io.connect('http://local.treeherder.mozilla.org:8005/events');
// Add a connect listener
socket.on('connect',function() {
socket.emit('subscribe', '*');
});
socket.on('job', function(msg){
console.log('new job update!');
console.log(msg);
})
socket.on('job_failure', function(msg){
console.log('new job failure!');
console.log(msg);
})
socket.on('resultset', function(msg){
console.log('new resultset!');
console.log(msg);
})
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment