Skip to content

Commit

Permalink
Merge pull request #6 from muzzammilshahid/fix-message-on-cbor
Browse files Browse the repository at this point in the history
Handle serializer on message receive
  • Loading branch information
muzzammilshahid authored May 3, 2024
2 parents 3915d82 + 3b8288e commit 1563845
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/src/session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "package:wamp/src/helpers.dart";
import "package:wamp/src/types.dart";
import "package:wampproto/idgen.dart";
import "package:wampproto/messages.dart" as msg;
import "package:wampproto/serializers.dart";
import "package:wampproto/session.dart";

class Session {
Expand All @@ -13,7 +14,12 @@ class Session {
Future.microtask(() async {
while (true) {
var message = await _baseSession.receive();
var decodedMessage = Uint8List.fromList((message as String).codeUnits);
Uint8List decodedMessage;
if (_baseSession.serializer == JSONSerializer()) {
decodedMessage = Uint8List.fromList((message as String).codeUnits);
} else {
decodedMessage = message as Uint8List;
}
_processIncomingMessage(_wampSession.receive(decodedMessage));
}
});
Expand Down

0 comments on commit 1563845

Please sign in to comment.