class Faye::Channel::Set
Public Class Methods
Public Instance Methods
Source
# File lib/faye/protocol/channel.rb, line 113 def distribute_message(message) channels = Channel.expand(message['channel']) channels.each do |name| channel = @channels[name] channel.trigger(:message, message) if channel end end
Source
# File lib/faye/protocol/channel.rb, line 90 def has_subscription?(name) @channels.has_key?(name) end
Source
# File lib/faye/protocol/channel.rb, line 86 def remove(name) @channels.delete(name) end
Source
# File lib/faye/protocol/channel.rb, line 94 def subscribe(names, subscription) names.each do |name| channel = @channels[name] ||= Channel.new(name) channel.bind(:message, &subscription) end end
Source
# File lib/faye/protocol/channel.rb, line 101 def unsubscribe(name, subscription) channel = @channels[name] return false unless channel channel.unbind(:message, &subscription) if channel.unused? remove(name) true else false end end