From 496bb3883c5e09c06efd2c76246f15cba5d8baf1 Mon Sep 17 00:00:00 2001 From: Lachlan Sylvester Date: Thu, 9 Jul 2015 17:50:50 +1000 Subject: update README to include creating the ApplicationCabel::Channel --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index efa3b52dc0..f16dfe7377 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,18 @@ module ApplicationCable end ``` +Then you should define your `ApplicationCable::Channel` class in Ruby. This is the place where you put +shared logic between your channels. + +```ruby +# app/channels/application_cable/channel.rb +```ruby +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end +``` + This relies on the fact that you will already have handled authentication of the user, and that a successful authentication sets a signed cookie with the `user_id`. This cookie is then automatically sent to the connection instance when a new connection is attempted, and you -- cgit v1.2.3