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

Handle progress yield and invocation #86

Merged
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
7 changes: 6 additions & 1 deletion lib/src/joiner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import "package:wampproto/src/types.dart";

final clientRoles = <String, Map<String, Map>>{
"caller": {"features": {}},
"callee": {"features": {}},
"callee": {
"features": {
"progressive_call_results": true,
"call_canceling": true,
},
},
"publisher": {"features": {}},
"subscriber": {"features": {}},
};
Expand Down
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
Loading