Tutorial by Examples

# app/channels/appearance_channel.rb class NotificationsChannel < ApplicationCable::Channel def subscribed stream_from "notifications" end def unsubscribed end def notify(data) ActionCable.server.broadcast "notifications", { title: 'New things!', ...
app/assets/javascripts/channels/notifications.coffee App.notifications = App.cable.subscriptions.create "NotificationsChannel", connected: -> # Called when the subscription is ready for use on the server $(document).on "change", "input", (e)=> ...
# app/channels/application_cable/connection.rb module ApplicationCable class Connection < ActionCable::Connection::Base identified_by :current_user def connect self.current_user = find_verified_user logger.add_tags 'ActionCable', current_user.id # Can replace...

Page 1 of 1