how create this project from scrash
-
rails 3.2.17 new project_name
-
add gem ‘thin’ , gem ‘faye’ to Gemfile
-
bundle install
-
add websocket library
edit views/layouts/accplication.html.erb : <%= javascript_include_tag 'http://localhost:9292/faye/client.js', "application" %>
-
create socket on any page , see view/score/index.erb for example
-
send data to subcriber ,see score_controller.rb
rackup faye.ru -s thin -E production -p 9292
rails s
-
goto localhost:3000/score
-
run command: curl localhost:9292/faye -d ‘message={“channel”:“/messages/score”, “data”:“hello”}’
-
run localhost:3000/score/broadcast/message to broadcast from server