Module: ApplicationCable

Defined in:
app/channels/application_cable/channel.rb,
app/channels/application_cable/connection.rb

Overview

Action Cable connection for real-time WebSocket features.

Currently used for:

  • Turbo Streams in CRM (retailer probe updates, sibling retailers tab)

Authentication:

  • CRM: Requires authenticated employee account (via Warden/Devise)
  • WWW: Not currently supported (connections rejected)

Future WWW Implementation (Option 2 - Lazy Connection):
When implementing real-time features for WWW (e.g., chat system):

  1. Don't auto-connect - wait until after globals.json establishes session
  2. Add visitor-based identification for anonymous users:
    identified_by :current_account, :current_visitor
  3. In primeval.js, create cable connection after globals.json:
    if (data.csrf) { window.App.cable = createConsumer('/cable') }
  4. Consider signed streams (Turbo 8+) for anonymous subscriptions

See: https://www.briankephart.com/rendering-views-through-action-cable-with-devise-and-cancancan

Defined Under Namespace

Classes: Channel, Connection