module Redis::Commands::Pubsub

def psubscribe(*channels, &block)

for further details
See the [Redis Server PSUBSCRIBE documentation](https://redis.io/docs/latest/commands/psubscribe/)
Listen for messages published to channels matching the given patterns.
def psubscribe(*channels, &block)
  _subscription(:psubscribe, 0, channels, block)
end

def psubscribe_with_timeout(timeout, *channels, &block)

for further details
See the [Redis Server PSUBSCRIBE documentation](https://redis.io/docs/latest/commands/psubscribe/)
Throw a timeout error if there is no messages for a timeout period.
Listen for messages published to channels matching the given patterns.
def psubscribe_with_timeout(timeout, *channels, &block)
  _subscription(:psubscribe_with_timeout, timeout, channels, block)
end

def publish(channel, message)

Post a message to a channel.
def publish(channel, message)
  send_command([:publish, channel, message])
end

def pubsub(subcommand, *args)

Possible subcommands: channels, numsub, numpat.
Inspect the state of the Pub/Sub subsystem.
def pubsub(subcommand, *args)
  send_command([:pubsub, subcommand] + args)
end

def punsubscribe(*channels)

for further details
See the [Redis Server PUNSUBSCRIBE documentation](https://redis.io/docs/latest/commands/punsubscribe/)
Stop listening for messages posted to channels matching the given patterns.
def punsubscribe(*channels)
  _subscription(:punsubscribe, 0, channels, nil)
end

def spublish(channel, message)

Post a message to a channel in a shard.
def spublish(channel, message)
  send_command([:spublish, channel, message])
end

def ssubscribe(*channels, &block)

Listen for messages published to the given channels in a shard.
def ssubscribe(*channels, &block)
  _subscription(:ssubscribe, 0, channels, block)
end

def ssubscribe_with_timeout(timeout, *channels, &block)

Throw a timeout error if there is no messages for a timeout period.
Listen for messages published to the given channels in a shard.
def ssubscribe_with_timeout(timeout, *channels, &block)
  _subscription(:ssubscribe_with_timeout, timeout, channels, block)
end

def subscribe(*channels, &block)

Listen for messages published to the given channels.
def subscribe(*channels, &block)
  _subscription(:subscribe, 0, channels, block)
end

def subscribe_with_timeout(timeout, *channels, &block)

if there is no messages for a timeout period.
Listen for messages published to the given channels. Throw a timeout error
def subscribe_with_timeout(timeout, *channels, &block)
  _subscription(:subscribe_with_timeout, timeout, channels, block)
end

def subscribed?

def subscribed?
  !@subscription_client.nil?
end

def sunsubscribe(*channels)

Stop listening for messages posted to the given channels in a shard.
def sunsubscribe(*channels)
  _subscription(:sunsubscribe, 0, channels, nil)
end

def unsubscribe(*channels)

Stop listening for messages posted to the given channels.
def unsubscribe(*channels)
  _subscription(:unsubscribe, 0, channels, nil)
end