Bump max_frame_size (#3050)

We use the WebSocket connection to send binary data (in the form of
shapefiles) from the engine to the client. These can very easily get
larger than the default 16MB limit on the max_frame_size. I don't
understand why it won't stich multiple frames together - but given what
I can see when this crashes, the max_message_size isn't the LIMFAC,
max_frame_size is.

That's an issue for future-us.

Signed-off-by: Paul Tagliamonte <paul@zoo.dev>
This commit is contained in:
Paul Tagliamonte
2024-07-17 15:32:57 -04:00
committed by GitHub
parent d30fbf8b4b
commit 2affc7271d
2 changed files with 15 additions and 2 deletions

View File

@ -160,11 +160,24 @@ impl EngineConnection {
Ok(())
}
#[allow(clippy::field_reassign_with_default)]
pub async fn new(ws: reqwest::Upgraded) -> Result<EngineConnection> {
// allowing the field_reassign_with_default lint here because the
// defaults for this object don't match the type defaults. We want
// to inherent the default config
//
// See the `impl Default for WebSocketConfig` in
// `tungstenite/protocol/mod.rs`
let mut wsconfig = tokio_tungstenite::tungstenite::protocol::WebSocketConfig::default();
// 4294967296 bytes, which is around 4.2 GB.
wsconfig.max_message_size = Some(0x100000000);
wsconfig.max_frame_size = Some(0x100000000);
let ws_stream = tokio_tungstenite::WebSocketStream::from_raw_socket(
ws,
tokio_tungstenite::tungstenite::protocol::Role::Client,
Some(tokio_tungstenite::tungstenite::protocol::WebSocketConfig { ..Default::default() }),
Some(wsconfig),
)
.await;