Class: PubsubHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/handler/pubsub_handler.rb

Instance Method Summary collapse

Instance Method Details

#recv(server, connection, packet) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/handler/pubsub_handler.rb', line 2

def recv(server,connection,packet)
  case packet.id
    when Protocol::SUBSCRIBE
      server.pubsub.subscribe(packet.ch, connection)
      puts "sub"
    when Protocol::UNSUBSCRIBE
      server.pubsub.unsubscribe(packet.ch, connection)
    when Protocol::PUBLISH
    
  end
end