class Redis::SubscribedClient

def subscription(start, stop, channels, block, timeout = 0)

def subscription(start, stop, channels, block, timeout = 0)
  sub = Subscription.new(&block)
  unsubscribed = false
  @client.call_loop([start, *channels], timeout) do |line|
    type, *rest = line
    sub.callbacks[type].call(*rest)
    unsubscribed = type == stop && rest.last == 0
    break if unsubscribed
  end
  # No need to unsubscribe here. The real client closes the connection
  # whenever an exception is raised (see #ensure_connected).
end