-
This is a demo application (for Codeaholics HK meetup) to show how to build up a chat room with security considered.
-
It is written in Ruby On Rails with Web Socket communication.
-
Web Socket communication channel can be secured by using HTTPS.
-
get your ruby on rails environment setup. I am using Ruby 1.9.3 and Rails 3.2.
-
download the project
git clone [email protected]:3dd13/codeaholics_chat_room.git
-
go into the project folder
cd codeaholics_chat_room
-
install all the dependencies
bundle install
-
prepare the MySQL database
cp database.yml.sample database.yml update database.yml with your mysql login password rake db:create rake db:migate
-
start the Rails application
rails s
-
open another terminal, start the Faye service
rackup private_pub.ru -s thin -E production
-
It is using Faye to provide the publish and subscription service: blog.jcoglan.com/2012/02/27/faye-0-8-the-refactoring/
-
Private_Pub is the Ruby Gem to handle the publish and subscription: github.com/ryanb/private_pub
-
Another project to do PubSubHub: code.google.com/p/pubsubhubbub/ (not being used in this application, just a reference you want to do Pub Sub Hub)
-
It is using MySQL database for the Rails development environment
basically it is relying on the Procfile to instruct heroku how to start the faye service. Check out the Procfile usage on heroku documentation if you are interested.
there are few things you have to do before deploying to production, in order to make sure it is secure. For example,
-
you have to change the token in private_pub.yml
-
you have to setup HTTPS for the publish and subscribe channel
-
you have to change the rails session store key
-
…