Skip to content

Instantly share code, notes, and snippets.

@codeincontext
Created September 21, 2011 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeincontext/1231766 to your computer and use it in GitHub Desktop.
Save codeincontext/1231766 to your computer and use it in GitHub Desktop.
A javascript class to subscribe via websocket to a redis channel
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