123456789_123456789_123456789_123456789_123456789_

Module: Redis::Commands::Pubsub

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/redis/commands/pubsub.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#subscribed?Boolean (readonly)

[ GitHub ]

  
# File 'lib/redis/commands/pubsub.rb', line 11

def subscribed?
  !@subscription_client.nil?
end

Instance Method Details

#psubscribe(*channels, &block)

Listen for messages published to channels matching the given patterns. See the Redis Server PSUBSCRIBE documentation for further details

[ GitHub ]

  
# File 'lib/redis/commands/pubsub.rb', line 34

def psubscribe(*channels, &block)
  _subscription(:psubscribe, 0, channels, block)
end

#psubscribe_with_timeout(timeout, *channels, &block)

Listen for messages published to channels matching the given patterns. Throw a timeout error if there is no messages for a timeout period. See the Redis Server PSUBSCRIBE documentation for further details

[ GitHub ]

  
# File 'lib/redis/commands/pubsub.rb', line 42

def psubscribe_with_timeout(timeout, *channels, &block)
  _subscription(:psubscribe_with_timeout, timeout, channels, block)
end

#publish(channel, message)

Post a message to a channel.

[ GitHub ]

  
# File 'lib/redis/commands/pubsub.rb', line 7

def publish(channel, message)
  send_command([:publish, channel, message])
end

#pubsub(subcommand, *args)

Inspect the state of the Pub/Sub subsystem. Possible subcommands: channels, numsub, numpat.

[ GitHub ]

  
# File 'lib/redis/commands/pubsub.rb', line 55

def pubsub(subcommand, *args)
  send_command([:pubsub, subcommand] + args)
end

#punsubscribe(*channels)

Stop listening for messages posted to channels matching the given patterns. See the Redis Server PUNSUBSCRIBE documentation for further details

[ GitHub ]

  
# File 'lib/redis/commands/pubsub.rb', line 49

def punsubscribe(*channels)
  _subscription(:punsubscribe, 0, channels, nil)
end

#spublish(channel, message)

Post a message to a channel in a shard.

[ GitHub ]

  
# File 'lib/redis/commands/pubsub.rb', line 60

def spublish(channel, message)
  send_command([:spublish, channel, message])
end

#ssubscribe(*channels, &block)

Listen for messages published to the given channels in a shard.

[ GitHub ]

  
# File 'lib/redis/commands/pubsub.rb', line 65

def ssubscribe(*channels, &block)
  _subscription(:ssubscribe, 0, channels, block)
end

#ssubscribe_with_timeout(timeout, *channels, &block)

Listen for messages published to the given channels in a shard. Throw a timeout error if there is no messages for a timeout period.

[ GitHub ]

  
# File 'lib/redis/commands/pubsub.rb', line 71

def ssubscribe_with_timeout(timeout, *channels, &block)
  _subscription(:ssubscribe_with_timeout, timeout, channels, block)
end

#subscribe(*channels, &block)

Listen for messages published to the given channels.

[ GitHub ]

  
# File 'lib/redis/commands/pubsub.rb', line 16

def subscribe(*channels, &block)
  _subscription(:subscribe, 0, channels, block)
end

#subscribe_with_timeout(timeout, *channels, &block)

Listen for messages published to the given channels. Throw a timeout error if there is no messages for a timeout period.

[ GitHub ]

  
# File 'lib/redis/commands/pubsub.rb', line 22

def subscribe_with_timeout(timeout, *channels, &block)
  _subscription(:subscribe_with_timeout, timeout, channels, block)
end

#sunsubscribe(*channels)

Stop listening for messages posted to the given channels in a shard.

[ GitHub ]

  
# File 'lib/redis/commands/pubsub.rb', line 76

def sunsubscribe(*channels)
  _subscription(:sunsubscribe, 0, channels, nil)
end

#unsubscribe(*channels)

Stop listening for messages posted to the given channels.

[ GitHub ]

  
# File 'lib/redis/commands/pubsub.rb', line 27

def unsubscribe(*channels)
  _subscription(:unsubscribe, 0, channels, nil)
end