Created
September 21, 2011 10:35
-
-
Save codeincontext/1231766 to your computer and use it in GitHub Desktop.
A javascript class to subscribe via websocket to a redis channel
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
function WebsocketNotifier() { | |
this.connect = function() { | |
var socket = new WebSocket('ws://10.0.1.9:8080') | |
that = this; | |
socket.onmessage = function(mess) { | |
console.log("eventmachine -> " + mess.data); | |
$(that).trigger('updatesAvailable'); | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment