Class: NotificationsChannel

Inherits:
ApplicationCable::Channel show all
Defined in:
app/channels/notifications_channel.rb

Instance Method Summary collapse

Instance Method Details

#subscribedObject


2
3
4
5
6
7
8
# File 'app/channels/notifications_channel.rb', line 2

def subscribed
  stop_all_streams
  logger.info "current connections: #{ActionCable.server.connections.count}"
  if self.current_user_id
    stream_from "notifications_count/#{self.current_user_id}"
  end
end

#unsubscribedObject


10
11
12
# File 'app/channels/notifications_channel.rb', line 10

def unsubscribed
  stop_all_streams
end