Skip to content

Instantly share code, notes, and snippets.

@verdi327
Created June 11, 2012 04:06
Show Gist options
  • Save verdi327/2908453 to your computer and use it in GitHub Desktop.
Save verdi327/2908453 to your computer and use it in GitHub Desktop.
Faye Subscribe Code
##Place this inside ChatRoom/Show
<% javascript_tag do %>
$(function() {
var client = new Faye.Client('http://fallinggarden.com/faye');
client.subscribe("/#{<%= @chat_room.id %>}", function(data) {
// do stuff here when receives the data
// use js to add a new li tag containing the @message.contents
});
});
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment