Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions rust/wasmtime/src/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,21 @@ impl Websocket {
}
};

// Latency-sensitive guests (QUIC over the message stream) write
// small messages back-to-back; Nagle would hold the second until
// the peer's delayed ACK. Browsers run WebSocket sockets with
// TCP_NODELAY; match them.
{
let tcp = match ws.get_ref() {
tokio_tungstenite::MaybeTlsStream::Plain(tcp) => Some(tcp),
tokio_tungstenite::MaybeTlsStream::Rustls(tls) => Some(tls.get_ref().0),
_ => None,
};
if let Some(tcp) = tcp {
let _ = tcp.set_nodelay(true);
}
}

let negotiated = response
.headers()
.get("Sec-WebSocket-Protocol")
Expand Down
Loading