Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wampproto to 0.1.2 with concurrent call fix and add progressiv… #18

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/wamp/message_handler/invocation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ def alt_store_key
end

def invocation_response
Type::Invocation.new(args: message.args, kwargs: message.kwargs, details: message.details)
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
Expand Down
6 changes: 5 additions & 1 deletion lib/wamp/message_handler/result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ module MessageHandler
class Result < Base
def handle
validate_received_message
stored_data.fetch(:handler).call(response)
if message.details[:progress]
store[store_key].fetch(:handler).call(response)
else
stored_data.fetch(:handler).call(response)
end
end

def response
Expand Down
9 changes: 9 additions & 0 deletions lib/wamp/type/invocation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ module Wamp
module Type
# Invocation Type
class Invocation
attr_writer :connection, :request_id
attr_reader :args, :kwargs, :details

def initialize(args: [], kwargs: {}, details: {})
@args = args
@kwargs = kwargs
@details = details
end

def progress(result)
@connection.transmit @connection.session.send_message(response(result))
end

def response(result)
Wampproto::Message::Yield.new(@request_id, result.details, *result.args, **result.kwargs)
end
end
end
end
2 changes: 1 addition & 1 deletion lib/wamp/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Wamp
VERSION = "0.1.0"
VERSION = "0.1.1"
end
2 changes: 1 addition & 1 deletion wamp.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
spec.add_dependency "ed25519", "~> 1.3"
spec.add_dependency "msgpack", "~> 1.7.2"
spec.add_dependency "nio4r", "~> 2.7"
spec.add_dependency "wampproto", "~> 0.1.1"
spec.add_dependency "wampproto", "~> 0.1.2"
spec.add_dependency "websocket-driver", "~> 0.7"
spec.metadata["rubygems_mfa_required"] = "true"
end