class RedisClient::PubSub

def call(*command, **kwargs)

def call(*command, **kwargs)
  raw_connection.write(@command_builder.generate(command, kwargs))
  nil
end

def call_v(command)

def call_v(command)
  raw_connection.write(@command_builder.generate(command))
  nil
end

def close

def close
  @raw_connection&.close
  @raw_connection = nil # PubSub can't just reconnect
  self
end

def initialize(raw_connection, command_builder)

def initialize(raw_connection, command_builder)
  @raw_connection = raw_connection
  @command_builder = command_builder
end

def next_event(timeout = nil)

def next_event(timeout = nil)
  unless raw_connection
    raise ConnectionError, "Connection was closed or lost"
  end
  raw_connection.read(timeout)
rescue ReadTimeoutError
  nil
end