module Wamp::Worker::BaseHandler

Public Class Methods

included(base) click to toggle source
# File lib/wamp/worker/handler.rb, line 9
def self.included(base)
  attr_reader :proxy, :command, :args, :kwargs, :details, :background

  base.extend(ClassMethods)
end

Public Instance Methods

configure(proxy, command, args, kwargs, details, background=false) click to toggle source

Configures the handler

# 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) click to toggle source

This method will send progress of the call to the caller

@param result - The value you would like to send to the caller for progress

# 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