Class: Async::Redis::Context::Psubscribe

Inherits:
Subscribe
  • Object
show all
Defined in:
lib/nchan_tools/rdsck.rb

Overview

doesn’t support psubscribe by default. can you believe it?!

Constant Summary collapse

MESSAGE =
'pmessage'

Instance Method Summary collapse

Instance Method Details

#listenObject



9
10
11
12
13
# File 'lib/nchan_tools/rdsck.rb', line 9

def listen
  while response = @connection.read_response
    return response if response.first == MESSAGE
  end
end

#subscribe(channels) ⇒ Object



15
16
17
18
# File 'lib/nchan_tools/rdsck.rb', line 15

def subscribe(channels)
  @connection.write_request ['PSUBSCRIBE', *channels]
  @connection.flush
end

#unsubscribe(channels) ⇒ Object



20
21
22
23
# File 'lib/nchan_tools/rdsck.rb', line 20

def unsubscribe(channels)
  @connection.write_request ['PUNSUBSCRIBE', *channels]
  @connection.flush
end