Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Utf8Decoder+JsonDecoder usage with TransportWebSocketLink #468

Open
orestesgaolin opened this issue Jul 31, 2024 · 1 comment
Open

Utf8Decoder+JsonDecoder usage with TransportWebSocketLink #468

orestesgaolin opened this issue Jul 31, 2024 · 1 comment
Assignees

Comments

@orestesgaolin
Copy link

Noticed that HttpLink got migrated to Utf8Decoder +JsonDecoder. Could we get similar improvements in TransportWebSocketLink here? I would love to see the example usage of the new approach with TransportWebSocketLink.

@knaeckeKami knaeckeKami self-assigned this Jul 31, 2024
@knaeckeKami
Copy link
Collaborator

knaeckeKami commented Jul 31, 2024

Hi!

It looks like this is impossible without changing the implementation of Dart SDKs Websocket or providing another implementation for web_socket_channel.

The underlying WebSocket already decodes the bytes to a String:
https://github.com/dart-lang/sdk/blob/8a7cde38b204b40d7954de85d5fa4be1abd952b3/sdk/lib/_http/websocket_impl.dart#L332

So there's no opportunity to decode both utf8 + json in one go.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants