Skip to content

Commit

Permalink
dont convert message to string for json serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahad-10 committed May 4, 2024
1 parent 9f5c7bf commit 45542c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
3 changes: 1 addition & 2 deletions lib/src/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ class Server {
Future.microtask(() async {
while (true) {
var message = await baseSession.receive();
var decodedMessage = Uint8List.fromList((message as String).codeUnits);
var msg = baseSession.serializer.deserialize(decodedMessage);
var msg = baseSession.serializer.deserialize(message);
await router.receiveMessage(baseSession, msg);
}
});
Expand Down
9 changes: 1 addition & 8 deletions lib/src/wsacceptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,7 @@ class WAMPSessionAcceptor {
final sessionStreamController = StreamController.broadcast();

wsStreamSubscription = ws.listen((message) {
dynamic data;
if (getSubProtocol(_serializer) == jsonSubProtocol) {
data = Uint8List.fromList((message as String).codeUnits);
} else {
data = message;
}

MapEntry<Uint8List, bool> received = a.receive(data);
MapEntry<Object, bool> received = a.receive(message);
ws.add(received.key);
if (received.value) {
wsStreamSubscription.onData(sessionStreamController.add);
Expand Down

0 comments on commit 45542c7

Please sign in to comment.