Skip to content

Commit 873c4a7

Browse files
Handle progress yield and invocation
1 parent 025eac8 commit 873c4a7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/src/session.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import "package:wampproto/messages.dart";
22
import "package:wampproto/serializers.dart";
3+
import "package:wampproto/src/dealer.dart";
34
import "package:wampproto/src/exception.dart";
45

56
class WAMPSession {
@@ -37,7 +38,10 @@ class WAMPSession {
3738
if (!_invocationRequests.containsKey(msg.requestID)) {
3839
throw ArgumentError("cannot yield for unknown invocation request");
3940
}
40-
_invocationRequests.remove(msg.requestID);
41+
bool progress = msg.options[optionProgress] ?? false;
42+
if (!progress) {
43+
_invocationRequests.remove(msg.requestID);
44+
}
4145

4246
return _serializer.serialize(msg);
4347
} else if (msg is Publish) {
@@ -78,8 +82,10 @@ class WAMPSession {
7882
if (!_callRequests.containsKey(msg.requestID)) {
7983
throw ProtocolError("received RESULT for invalid request ID ${msg.requestID}");
8084
}
81-
_callRequests.remove(msg.requestID);
82-
85+
bool progress = msg.details["progress"] ?? false;
86+
if (!progress) {
87+
_callRequests.remove(msg.requestID);
88+
}
8389
return msg;
8490
} else if (msg is Registered) {
8591
if (!_registerRequests.containsKey(msg.requestID)) {

0 commit comments

Comments
 (0)