-
Notifications
You must be signed in to change notification settings - Fork 17
Installation and Setup
Getting started is quick and painless.
-
Add the
websocket-rails
gem to your Gemfile and run thebundle
command. -
Run the installation generator:
rails g websocket_rails:install
-
Create a new [WebsocketRails Controller](WebsocketRails Controllers) and direct events to it using the Event Router.
-
Remove the Rack::Lock middleware by adding the following line to your
environments/development.rb
file.
config.middleware.delete Rack::Lock
- 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 Event Router Wiki.
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.
If you are not using an EventMachine based production web server such as Thin, you will need to use the standalone server mode. Refer to the wiki for more information.
If you are upgrading from an older version of the gem, check out the Configuration Wiki to see the new options available.