Created
January 14, 2012 15:33
-
-
Save adunkman/1611799 to your computer and use it in GitHub Desktop.
Relay messages from RabbitMQ to a browser using Socket.io - client
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="/socket.io/socket.io.js"></script> | |
<script> | |
(function () { | |
var onMessage = function (data) { | |
// Do something with the message data | |
}; | |
var connectToServer = function () { | |
var socket = io.connect('http://localhost:8080'); | |
socket.on('message-name', onMessage); | |
}; | |
connectToServer(); | |
})(); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment