Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
Update ouisync, fix notification handling
Browse files Browse the repository at this point in the history
  • Loading branch information
madadam committed Sep 7, 2023
1 parent 174fd1c commit 661025b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions lib/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ class Client {

final isSuccess = message.containsKey('success');
final isFailure = message.containsKey('failure');
final responseCompleter = _responses.remove(id);
final isNotification = message.containsKey('notification');

if (isSuccess || isFailure) {
final responseCompleter = _responses.remove(id);
if (responseCompleter == null) {
print('unsolicited response');
continue;
Expand All @@ -98,18 +99,19 @@ class Client {
} else if (isFailure) {
_handleResponseFailure(responseCompleter, message['failure']);
}
} else if (responseCompleter != null) {
_handleInvalidResponse(responseCompleter);
}

if (message.containsKey('notification')) {
} else if (isNotification) {
final subscription = _subscriptions[id];
if (subscription == null) {
print('unsolicited notification');
continue;
}

_handleNotification(subscription, message['notification']);
} else {
final responseCompleter = _responses.remove(id);
if (responseCompleter != null) {
_handleInvalidResponse(responseCompleter);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ouisync

0 comments on commit 661025b

Please sign in to comment.