I want to create a public live chat application using rails 3.
I found some example on rails 2. Any one can tell you a good example / tutorial to develop a live chat application using rails 3.
I encountered several roadblocks as I tried to implement a public and private chat system in my rails 3 app. I looked at faye, juggernaut, node.js and more. Eventually after trying several approaches I was able to implement a system that works great:
1) I started by following the video guide to faye messaging in Railscast 260 as mentioned by Devin M. I was able to quickly setup a rails app that persisted messages, and a chat server that pushed these new messages out to all the clients. The biggest problem was security. I had no control over access to the chat server.
2) This lead me to using the private pub gem by Ryan Bates in Railscast 316 - which helps to secure your faye server by verifying the client's signature. This worked for securing the server but I ran into issues trying to verify the actual user with my authentication system and adding 'who's online' functionality. I worked on a hack of private pub to pass in the user details when authenticating but could not get things to work smoothly.
3) In the end I decided to move the chat server to pusher - a hosted API for real-time apps. I followed this tutorial on how to create a real-time survey in rails to get a feel for how to set things up. Although not directly about setting up a chat system - this tutorial along with what I had already setup from the Railscasts above (and the easy-to-read pusher docs), allowed me to quickly setup a secure rails 3 chat app - complete with authentication, 'who's online', status messages and more. The best part is...I don't have to deal with managing the chat server.
Hope this helps someone going through the same process as me.