Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add a way to send a pre-encoded string as a text frame over a WebSocket #27129

rmacnak-google opened this issue Aug 22, 2016 · 0 comments


Copy link

commented Aug 22, 2016

In the vm-service, we have have some large (tens of megabytes) responses that are constructed in C++ and efficiently moved to the service isolate without copying as an external Uint8List. Unfortunately, the current WebSocket API doesn't have a way to send a text frame without converting this Uint8List into a String (UTF8 decode), which the WebSocket implementation then converts back to Uint8List (UTF8 encode). The 3x space overhead of the round-trip conversion can be fatal in memory-constrained environments like iOS.

A possible API change would be to add WebSocket.sendMessage(TEXT | BINARY type, List<int> bytes), as proposed in

@zanderso @lrhn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.