-
Notifications
You must be signed in to change notification settings - Fork 12
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
Max message size #73
Comments
👍
Don't, for several reasons:
If you made a flow graph for this, there would be large gaps in multiple places significantly decreasing throughput.
Instead, I would propose the following:
If you do that, you can go well beyond 50 MiB. (This will be a lot less ugly once RTCDataChannel has a streaming API. The WHATWG people are interested in porting this to WebSocket as well.) |
Can you elaborate? Can't we just pass all the chunks to the websocket, and the socket should handle buffering? |
No. If you do that the WebSocket will simply close when it exceeds some internal buffer threshold. It's a terrible API design:
https://html.spec.whatwg.org/multipage/web-sockets.html#dom-websocket-send |
Ok. That's on the web side though. (I guess you're right about that one.) In our case, the sending of the data from Rust happens inside the relayed data task. The outside code does not (and should not) have access to the internals of the WebSocket. Thus, no access to the buffered amount, unless chunking is part of the task. And I do not thing chunking belongs in the task (some applications might not need chunking at all if only small messages are exchanged). I guess I should simply try it and see what happens. |
Hm, actually I guess the task could handle buffering without caring about chunking... |
You will have to have some API that exposes a way to control the flow of the stream. You could mimic the The ideal way would be to use the Streams API create a |
Closed in favour of #72 |
Currently when sending 4 MiB messages over the websocket, the connection is closed with status code 1009.
If you take a look at the WS server docs, you can see that the limit is 1 MiB by default.
I would suggest to document this limit, and to make the two values configurable by the user, since the limits should depend on the use case. For the WebRTC Task, 1 MiB is more than enough. For Threema Web + Relayed Data, we'd like to support messages up to maybe 50 MiB.
The problem is that according to the docs above, 50 MiB limits @ queue size 32 might result in memory use up to 6.4 GiB per process (worst case).
Chunking might be a possibility, but it's a bit stupid to do chunking on top of a chunked protocol.
@lgrahl RFC :)
The text was updated successfully, but these errors were encountered: