Sha256: 7b0f961ce7a8501206224bdffa146f10dccf5da2114a80d9c2855ba40acb0ec1
Contents?: true
Size: 1022 Bytes
Versions: 5
Compression:
Stored size: 1022 Bytes
Contents
class Cubism::PresenceChannel < ActionCable::Channel::Base include CableReady::StreamIdentifier def subscribed if resource.present? stream_for resource resource.cubicle_element_ids << element_id resource.excluded_user_id_for_element_id[element_id] = user.id if exclude_current_user? else reject end end def unsubscribed return unless resource.present? resource.cubicle_element_ids.remove(element_id) resource.excluded_user_id_for_element_id.delete(element_id) disappear end def appear resource.present_users.add(user.id) end def disappear resource.present_users.remove(user.id) end private def resource locator = verified_stream_identifier(params[:identifier]) GlobalID::Locator.locate(locator) end def user GlobalID::Locator.locate_signed(params[:user]) end def exclude_current_user? params[:exclude_current_user] end def element_id params[:element_id] end def url params[:url] end end
Version data entries
5 entries across 5 versions & 1 rubygems