fix(websocket): byte-based caps for pending buffer + inbound WS sizes (WS-05, WS-06)
This commit is contained in:
@@ -21,7 +21,7 @@ use axum::extract::ws::WebSocketUpgrade;
|
||||
use axum::http::StatusCode;
|
||||
use axum::response::{IntoResponse, Response};
|
||||
|
||||
use super::byte_adapter::split_ws_to_bytes;
|
||||
use super::byte_adapter::{split_ws_to_bytes, INBOUND_WS_FRAME_CAP, INBOUND_WS_MESSAGE_CAP};
|
||||
|
||||
/// The channels session for an upgraded socket: adapt → `Connection`
|
||||
/// (identity attached) → `ChannelsAdapter::handle`. `policy` gates
|
||||
@@ -140,9 +140,12 @@ pub async fn ws_upgrade_handler(
|
||||
let policy = policy
|
||||
.map(|axum::Extension(p)| p.0)
|
||||
.unwrap_or_else(|| Arc::new(NoCap));
|
||||
ws_upgrade.on_upgrade(move |socket| async move {
|
||||
run_channels_session(socket, registry, identity, policy).await
|
||||
})
|
||||
ws_upgrade
|
||||
.max_frame_size(INBOUND_WS_FRAME_CAP)
|
||||
.max_message_size(INBOUND_WS_MESSAGE_CAP)
|
||||
.on_upgrade(move |socket| async move {
|
||||
run_channels_session(socket, registry, identity, policy).await
|
||||
})
|
||||
}
|
||||
|
||||
/// Bearer-auth middleware for the WS upgrade route: resolves the token
|
||||
|
||||
Reference in New Issue
Block a user