From d5179a5812d55f41ad3fd8d68e75308db68ae573 Mon Sep 17 00:00:00 2001 From: Muzzammil Shahid Date: Tue, 14 May 2024 21:11:20 +0500 Subject: [PATCH] Handle progress yield and invocation --- lib/src/session.dart | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/src/session.dart b/lib/src/session.dart index df0ff9f..eff19d9 100644 --- a/lib/src/session.dart +++ b/lib/src/session.dart @@ -1,5 +1,6 @@ import "package:wampproto/messages.dart"; import "package:wampproto/serializers.dart"; +import "package:wampproto/src/dealer.dart"; import "package:wampproto/src/exception.dart"; class WAMPSession { @@ -37,7 +38,10 @@ class WAMPSession { if (!_invocationRequests.containsKey(msg.requestID)) { throw ArgumentError("cannot yield for unknown invocation request"); } - _invocationRequests.remove(msg.requestID); + bool progress = msg.options[optionProgress] ?? false; + if (!progress) { + _invocationRequests.remove(msg.requestID); + } return _serializer.serialize(msg); } else if (msg is Publish) { @@ -78,8 +82,10 @@ class WAMPSession { if (!_callRequests.containsKey(msg.requestID)) { throw ProtocolError("received RESULT for invalid request ID ${msg.requestID}"); } - _callRequests.remove(msg.requestID); - + bool progress = msg.details["progress"] ?? false; + if (!progress) { + _callRequests.remove(msg.requestID); + } return msg; } else if (msg is Registered) { if (!_registerRequests.containsKey(msg.requestID)) {