Created
December 20, 2013 17:11
-
-
Save maurodoglio/8058063 to your computer and use it in GitHub Desktop.
treeherder socketio client example
This file contains 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
<!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