Skip to content

Instantly share code, notes, and snippets.

@anka
Created August 19, 2017 12:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Notification channel implementation
class NotificaitonChannel < ApplicationCable::Channel
def subscribed
# Get the parameter from client side
param1 = params['param1']
# Open stream for a parameterized channel
stream_from "notification_channel_#{param1}"
end
def unsubscribed
# Any cleanup needed when channel is unsubscribed
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment