BruceEckel/OpenSpacesBoard — pull request #17 by jcerise (2014-02-06 07:40:53+00:00)
Title: Working websockets!

Lots to go over here, so one item at a time

-Added the websocket-rails gem
-Installed websocket-rails gem (rails g websocket_rails:install)
-Configrued the events router (config/events.rb) to subscribe to new_topic event
-Added new controller to handle events from the events router (socket_controller.rb)
--This event is triggered just after a new topic is saved. It grabs the new topic from the db, and sends along all the relevant information (title, desc, author) to the client
-Updated board.js.coffee to bind to new_topic events. When the event is broadcast, the JS updates the appropriate table cell with the new topic information
-Creating a new topic triggers the new_topic event. The new topic is displayed on the users machine through the event binding described above, instead of via refresh, as before
-Made the find_user_name_by_id method public (in application_controller)

To test out the websocket stuff, run the server (I think you need to use thin as the server, but I can't verify this at the moment), open two tabs at the app, and create a new topic. It should update in both tabs simultaneously.
****This won't work on Windows, as a dependency for websocket-rails will not install in Windows****