Skip to content

Installation and Setup

Dan Knox edited this page Jul 18, 2012 · 7 revisions

Getting started is quick and painless.

  1. Add the websocket-rails gem to your Gemfile and run the bundle command.

  2. Run the installation generator: rails g websocket_rails:install

  3. Create a new [WebsocketRails Controller](WebsocketRails Controllers) and direct events to it using the Event Router.

  4. Enable the config.threadsafe! setting in your development.rb and production.rb files.

  5. Start the web server: thin start

The generator will create a new event route file located at config/initializers/events.rb. You can use this file to direct incoming events to controller actions. More information on using the event router is located in the Documentation.

The generator will also require the JavaScript client in your application.js manifest file. The JavaScript client allows you to bind callback functions to events published from your Rails application and trigger new events back on the server.