This is mainly an annotation of the Rails ActionCable documentation, with additional information for using it with React and publishing to Heroku.
Most of the boilerplate files can be generated with e.g. rails g channel Game
to create a channel named GameChannel.
The generator will create a subscription file in e.g. app/assets/javascripts/subscriptions/game.coffee
that contains the code to create a new subscription. You can safely delete this file, because this code will be moved into a React component instead.
Section 3.1.1 discusses a signed cookie to authorize the connection. This can be accomplished by using a Warden initialization hook. Keep in mind that the initializer in the article should be placed in config/initializers/warden_hooks.rb
instead of app/config/initializers/warden_hooks.rb
. If your Rails server is curr