Ruby on Rails 3 - Public live chat

前端 未结 3 720
抹茶落季
抹茶落季 2021-02-02 03:41

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 ap

相关标签:
3条回答
  • 2021-02-02 04:23

    You can get the basics down with Railscast 260, I assume a background in Rails/Ruby already and some knowedge of jQuery/JavaScript. The screencast has a text version here and the source is here, it's also on GitHub.

    0 讨论(0)
  • 2021-02-02 04:31

    I'd start by checking out Ilya Grigorik's em-synchony + examples and looking at the code for the Hector private chat server gem.

    0 讨论(0)
  • 2021-02-02 04:44

    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.

    0 讨论(0)
提交回复
热议问题