Skip to content

Commit

Permalink
Handle progress yield and invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
muzzammilshahid committed Jul 29, 2024
1 parent 7cf240a commit d5179a5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/src/session.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit d5179a5

Please sign in to comment.