Created
June 11, 2012 04:06
-
-
Save verdi327/2908453 to your computer and use it in GitHub Desktop.
Faye Subscribe Code
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
##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