module Redis::Commands::Pubsub
Public Instance Methods
psubscribe(*channels, &block)
click to toggle source
Listen for messages published to channels matching the given patterns.
# File lib/redis/commands/pubsub.rb, line 32 def psubscribe(*channels, &block) _subscription(:psubscribe, 0, channels, block) end
psubscribe_with_timeout(timeout, *channels, &block)
click to toggle source
Listen for messages published to channels matching the given patterns. Throw a timeout error if there is no messages for a timeout period.
# File lib/redis/commands/pubsub.rb, line 38 def psubscribe_with_timeout(timeout, *channels, &block) _subscription(:psubscribe_with_timeout, timeout, channels, block) end
publish(channel, message)
click to toggle source
Post a message to a channel.
# File lib/redis/commands/pubsub.rb, line 7 def publish(channel, message) send_command([:publish, channel, message]) end
pubsub(subcommand, *args)
click to toggle source
Inspect the state of the Pub/Sub subsystem. Possible subcommands: channels, numsub, numpat.
# File lib/redis/commands/pubsub.rb, line 49 def pubsub(subcommand, *args) send_command([:pubsub, subcommand] + args) end
punsubscribe(*channels)
click to toggle source
Stop listening for messages posted to channels matching the given patterns.
# File lib/redis/commands/pubsub.rb, line 43 def punsubscribe(*channels) _subscription(:punsubscribe, 0, channels, nil) end
subscribe(*channels, &block)
click to toggle source
Listen for messages published to the given channels.
# File lib/redis/commands/pubsub.rb, line 16 def subscribe(*channels, &block) _subscription(:subscribe, 0, channels, block) end
subscribe_with_timeout(timeout, *channels, &block)
click to toggle source
Listen for messages published to the given channels. Throw a timeout error if there is no messages for a timeout period.
# File lib/redis/commands/pubsub.rb, line 22 def subscribe_with_timeout(timeout, *channels, &block) _subscription(:subscribe_with_timeout, timeout, channels, block) end
subscribed?()
click to toggle source
# File lib/redis/commands/pubsub.rb, line 11 def subscribed? !@subscription_client.nil? end
unsubscribe(*channels)
click to toggle source
Stop listening for messages posted to the given channels.
# File lib/redis/commands/pubsub.rb, line 27 def unsubscribe(*channels) _subscription(:unsubscribe, 0, channels, nil) end