Module: Wamp::Worker::BaseHandler::ClassMethods

Defined in:
lib/wamp/worker/handler.rb

Instance Method Summary collapse

Instance Method Details

#create(proxy, command, args, kwargs, details) ⇒ Object

Instantiates the object



19
20
21
22
23
# File 'lib/wamp/worker/handler.rb', line 19

def create(proxy, command, args, kwargs, details)
  handler = self.new
  handler.configure(proxy, command, args, kwargs, details)
  handler
end

#register(procedure, method, name: nil, **options) ⇒ Object

Register the handler for a procedure

Parameters:

  • procedure (String)
    • The procedure to register for

  • method (Symbol)
    • The name of the method to execute

  • options (Hash)
    • Options for the subscription



42
43
44
45
46
47
# File 'lib/wamp/worker/handler.rb', line 42

def register(procedure, method, name: nil, **options)
  klass = self
  Wamp::Worker::configure name do
    register procedure, klass, method, **options
  end
end

#subscribe(topic, method, name: nil, **options) ⇒ Object

Subscribe the handler to a topic

Parameters:

  • topic (String)
    • The topic to subscribe to

  • method (Symbol)
    • The name of the method to execute

  • options (Hash)
    • Options for the subscription



30
31
32
33
34
35
# File 'lib/wamp/worker/handler.rb', line 30

def subscribe(topic, method, name: nil, **options)
  klass = self
  Wamp::Worker::configure name do
    subscribe topic, klass, method, **options
  end
end