Module: Wamp::Worker::BaseHandler
- Defined in:
- lib/wamp/worker/handler.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#configure(proxy, command, args, kwargs, details, background = false) ⇒ Object
Configures the handler.
-
#progress(result) ⇒ Object
This method will send progress of the call to the caller.
Class Method Details
.included(base) ⇒ Object
9 10 11 12 13 |
# File 'lib/wamp/worker/handler.rb', line 9 def self.included(base) attr_reader :proxy, :command, :args, :kwargs, :details, :background base.extend(ClassMethods) end |
Instance Method Details
#configure(proxy, command, args, kwargs, details, background = false) ⇒ Object
Configures the handler
52 53 54 55 56 57 58 59 |
# File 'lib/wamp/worker/handler.rb', line 52 def configure(proxy, command, args, kwargs, details, background=false) @proxy = proxy @command = command @args = args || [] @kwargs = kwargs || {} @details = details || {} @background = background end |
#progress(result) ⇒ Object
This method will send progress of the call to the caller
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/wamp/worker/handler.rb', line 64 def progress(result) # Only allow progress if it is a procedure and the client set "receive_progress" if command.to_sym == :procedure and self.details[:receive_progress] # Get the request ID request = self.details[:request] # Send the data back to the self.session.yield request, result, { progress: true }, self.background end end |