Sha256: 43b36785611c32559a50b99a24e99239b73a5338317a248df01026fdac4cf4cd
Contents?: true
Size: 1.72 KB
Versions: 3
Compression:
Stored size: 1.72 KB
Contents
require_relative "base" require "wamp/client/message" module Wamp module Client module Request class Message::Published def request_id self.publish_request end end class Publish < Base def create_request(request_id, topic, args=nil, kwargs=nil, options={}, &callback) # Create the lookup lookup = options[:acknowledge] ? {t: topic, a: args, k: kwargs, o: options, c: callback} : nil # Create the message message = Message::Publish.new(request_id, options, topic, args, kwargs) # Return [lookup, message] end def process_success(message, lookup) if lookup # Get the params topic = lookup[:t] args = lookup[:a] kwargs = lookup[:k] options = lookup[:o] callback = lookup[:c] # Create the details details = {} details[:topic] = topic details[:type] = 'publish' details[:publication] = message.publication # Return the values [callback, { args: args, kwargs: kwargs, options: options }, details] else [nil, nil, nil] end end def process_error(message, lookup) if lookup # Get the params topic = lookup[:t] callback = lookup[:c] # Create the details details = message.details || {} details[:topic] = topic unless details[:topic] details[:type] = 'publish' # Return the values [callback, details] else [nil, nil] end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
wamp_client-0.2.2 | lib/wamp/client/request/publish.rb |
wamp_client-0.2.1 | lib/wamp/client/request/publish.rb |
wamp_client-0.2.0 | lib/wamp/client/request/publish.rb |