Sha256: f41e153887f4f2a5b0f03b278b3fbb32fd5afafaeab022130cb441f90983932d
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true module Wamp module MessageHandler # Call class Invocation < Base def handle connection.session.receive_message(message) data = store.fetch(alt_store_key) send_yield_message data.fetch(:handler) end def alt_store_key "registration_#{message.registration_id}" end def invocation_response Type::Invocation.new(args: message.args, kwargs: message.kwargs, details: message.details).tap do |invocation| invocation.connection = connection invocation.request_id = message.request_id end end private def send_yield_message(handler) result = handler.call(invocation_response) yield_message = if result.instance_of?(Type::Result) Wampproto::Message::Yield.new(message.request_id, result.details, *result.args, **result.kwargs) else Wampproto::Message::Yield.new(message.request_id, {}, result) end send_serialized yield_message end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
xconn-0.1.2 | lib/wamp/message_handler/invocation.rb |
xconn-0.1.1 | lib/wamp/message_handler/invocation.rb |