Support setting maximum WebSocket frame size for streaming (non-actor) handlers
Expected Behavior
There should be a way to increase the maximum WebSocket frame size for streaming (non-actor) stream handlers. Whenever sending large payloads through WebSockets, I'm getting this error on the server:
WebSocket stream error: payload reached size limit
Current Behavior
As per above.
Possible Solution
I attempted to implement solution on an in-tree branch of actix-extras, but it is not working:
https://github.com/singularsyntax/actix-extras/commit/18c17b5027d64060a0bf659eaa48f15df7efe89a
Steps to Reproduce (for bugs)
- Generate a WebSocket message frame on a client exceeding the default max frame size (64k).
Context
Your Environment
- rustc 1.78.0 (9b00956e5 2024-04-29)
actix-*crate versions: actix-ws = "0.2.5"
I guess what we want is something similar to actix-web-actor's WsResponseBuilder in actix-ws.
+1 on this; this is blocking our migration from the now deprecated actix-web-actors
I think https://github.com/actix/actix-extras/pull/430 addresses this well enough, and as outlined in the example, one can:
let (response, mut session, stream) = actix_ws::handle(&req, body)?;
// increase the maximum allowed frame size to 128KiB and aggregate continuation frames
let mut stream = stream.max_frame_size(128 * 1024).aggregate_continuations();
Does that mean we still need a builder? I was playing around trying to add a builder, and saw no additional value. It feels like this post-initialization configuration on the stream makes more sense.
@robjtede what are your thoughts?
agreed, this is satisfied by #430