Class: Wamp::Manager::RegisteredEvent

Inherits:
Base
  • Object
show all
Defined in:
lib/wamp/manager/hello_event.rb

Overview

Registered Message Decorator

Instance Attribute Summary

Attributes inherited from Base

#session

Instance Method Summary collapse

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(handler) ⇒ Object



247
248
249
250
251
252
253
# File 'lib/wamp/manager/hello_event.rb', line 247

def add_event_listener(handler)
  session.on(listen_event_name) do |invocation|
    result = handler.call(invocation)
    message = Message::Yield.new(invocation.request_id, {}, result)
    session.transmit(message.payload)
  end
end

#emit_event_nameObject



238
239
240
# File 'lib/wamp/manager/hello_event.rb', line 238

def emit_event_name
  "request_#{request_id}"
end

#listen_event_nameObject

Adding listener for invocation message



243
244
245
# File 'lib/wamp/manager/hello_event.rb', line 243

def listen_event_name
  "registration_#{registration_id}"
end