Sha256: 5638485af94f6dbc0bee5c145d57675185649864ed2496f7af32fdd3e5e6d46d

Contents?: true

Size: 504 Bytes

Versions: 5

Compression:

Stored size: 504 Bytes

Contents

class Cubism::PresenceChannel < ActionCable::Channel::Base
  include CableReady::StreamIdentifier

  def subscribed
    if resource.present?
      stream_for resource
      resource.present_users.add(current_user.id)
    else
      reject
    end
  end

  def unsubscribed
    return unless resource.present?

    resource.present_users.remove(current_user.id)
  end

  private

  def resource
    locator = verified_stream_identifier(params[:identifier])
    GlobalID::Locator.locate(locator)
  end
end

Version data entries

5 entries across 3 versions & 1 rubygems

Version Path
cubism-0.1.0.pre3 app/channels/cubism/presence_channel.rb~
cubism-0.1.0.pre2 app/channels/cubism/presence_channel.rb
cubism-0.1.0.pre2 app/channels/cubism/presence_channel.rb~
cubism-0.1.0.pre1 app/channels/cubism/presence_channel.rb
cubism-0.1.0.pre1 app/channels/cubism/presence_channel.rb~