Sha256: f7641709f9ab9b5eecd2877dff407fcb04cfa902129d99045c97a1533cae35d7
Contents?: true
Size: 1019 Bytes
Versions: 4
Compression:
Stored size: 1019 Bytes
Contents
require 'redis-objects' module WebsocketRails class << self def channel_manager @channel_manager ||= ChannelManager.new end def [](channel) channel_manager[channel] end def channel_tokens channel_manager.channel_tokens end def filtered_channels channel_manager.filtered_channels end end class ChannelManager attr_reader :channels, :filtered_channels def initialize @channels = {}.with_indifferent_access @filtered_channels = {}.with_indifferent_access end def channel_tokens @channel_tokens ||= begin if WebsocketRails.synchronize? ::Redis::HashKey.new('websocket_rails.channel_tokens', Synchronization.redis) else {} end end end def [](channel) @channels[channel] ||= Channel.new channel end def unsubscribe(connection) @channels.each do |channel_name, channel| channel.unsubscribe(connection) end end end end
Version data entries
4 entries across 4 versions & 2 rubygems