Skip to content

Commit

Permalink
Merge pull request #54 from muzzammilshahid/adapt-to-latest-wampproto
Browse files Browse the repository at this point in the history
Adapt to latest wampproto changes
  • Loading branch information
muzzammilshahid authored Jul 6, 2024
2 parents ccab52f + efa8171 commit 7c0e7e3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lib/src/realm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Realm {
case Call.id:
case Yield.id:
case Register.id:
case UnRegister.id:
case Unregister.id:
MessageWithRecipient recipient = _dealer.receiveMessage(sessionID, msg);
var client = _clients[recipient.recipient];
client?.sendMessage(recipient.message);
Expand All @@ -63,7 +63,7 @@ class Realm {
break;

case Subscribe.id:
case UnSubscribe.id:
case Unsubscribe.id:
MessageWithRecipient? recipient = _broker.receiveMessage(sessionID, msg);
if (recipient == null) {
throw Exception("recipient null");
Expand Down
12 changes: 6 additions & 6 deletions lib/src/session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Session {
);
_baseSession.send(data);
}
} else if (message is msg.UnRegistered) {
} else if (message is msg.Unregistered) {
var request = _unregisterRequests.remove(message.requestID);
if (request != null) {
_registrations.remove(request.registrationID);
Expand All @@ -90,7 +90,7 @@ class Session {
if (endpoint != null) {
endpoint(Event(args: message.args, kwargs: message.kwargs, details: message.details));
}
} else if (message is msg.UnSubscribed) {
} else if (message is msg.Unsubscribed) {
var request = _unsubscribeRequests.remove(message.requestID);
if (request != null) {
_subscriptions.remove(request.subscriptionId);
Expand All @@ -112,7 +112,7 @@ class Session {
);
break;

case msg.UnRegister.id:
case msg.Unregister.id:
var unregisterRequest = _unregisterRequests.remove(message.requestID);
unregisterRequest?.future.completeError(
ApplicationError(message.uri, args: message.args, kwargs: message.kwargs),
Expand All @@ -126,7 +126,7 @@ class Session {
);
break;

case msg.UnSubscribe.id:
case msg.Unsubscribe.id:
var unsubscribeRequest = _unsubscribeRequests.remove(message.requestID);
unsubscribeRequest?.future.completeError(
ApplicationError(message.uri, args: message.args, kwargs: message.kwargs),
Expand Down Expand Up @@ -182,7 +182,7 @@ class Session {
}

Future<void> unregister(Registration reg) {
var unregister = msg.UnRegister(_nextID, reg.registrationID);
var unregister = msg.Unregister(_nextID, reg.registrationID);

var completer = Completer();
_unregisterRequests[unregister.requestID] = UnregisterRequest(completer, reg.registrationID);
Expand Down Expand Up @@ -223,7 +223,7 @@ class Session {
}

Future<void> unsubscribe(Subscription sub) {
var unsubscribe = msg.UnSubscribe(_nextID, sub.subscriptionID);
var unsubscribe = msg.Unsubscribe(_nextID, sub.subscriptionID);

var completer = Completer<void>();
_unsubscribeRequests[unsubscribe.requestID] = UnsubscribeRequest(completer, sub.subscriptionID);
Expand Down
8 changes: 4 additions & 4 deletions test/router_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ void main() {
});

test("unregister", () async {
var unregisterMsg = msg.UnRegister(5, registrationID);
var unregisterMsg = msg.Unregister(5, registrationID);
await router.receiveMessage(clientSideBase, unregisterMsg);

var unregistered = await clientSideBase.receiveMessage();
expect(unregistered, isA<msg.UnRegistered>());
expect(unregistered, isA<msg.Unregistered>());
});

late int subscriptionID;
Expand Down Expand Up @@ -81,10 +81,10 @@ void main() {
});

test("unsubscribe", () async {
var unsubscribeMsg = msg.UnSubscribe(9, subscriptionID);
var unsubscribeMsg = msg.Unsubscribe(9, subscriptionID);
await router.receiveMessage(clientSideBase, unsubscribeMsg);

var unsubscribed = await clientSideBase.receiveMessage();
expect(unsubscribed, isA<msg.UnSubscribed>());
expect(unsubscribed, isA<msg.Unsubscribed>());
});
}

0 comments on commit 7c0e7e3

Please sign in to comment.