Class: Wamp::Manager::SubscribeEvent
- Defined in:
- lib/wamp/manager/hello_event.rb
Overview
Subscribe Event
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #add_event_listener(listener, &block) ⇒ Object
- #emit_event_name ⇒ Object
- #listen_event_name ⇒ Object
Methods inherited from Base
#auth, #authenticate, constantize, demodulize, #emit_event, #initialize, instance_from, #on_message, #run, #transmit
Constructor Details
This class inherits a constructor from Wamp::Manager::Base
Instance Method Details
#add_event_listener(listener, &block) ⇒ Object
98 99 100 101 102 103 104 105 106 |
# File 'lib/wamp/manager/hello_event.rb', line 98 def add_event_listener(listener, &block) session.on(listen_event_name) do |subscribed, error| session.off(listen_event_name) block.call(subscribed, error) if block_given? manager = SubscribedEvent.new(subscribed, session) manager.add_event_listener(listener) end session.transmit(payload) end |
#emit_event_name ⇒ Object
94 95 96 |
# File 'lib/wamp/manager/hello_event.rb', line 94 def emit_event_name raise RuntimeError end |
#listen_event_name ⇒ Object
108 109 110 |
# File 'lib/wamp/manager/hello_event.rb', line 108 def listen_event_name "request_#{request_id}" end |