#2386·Ocelot

Add configurable WebSocket buffer size per route

Author: erannevoCreated Apr 30, 2026Updated Jul 2, 2026
LabelsfeatureacceptedWebsocketsCoreAutumn'26

Expected Behavior / New Feature

Each route should support an optional WebSocketBufferSize configuration property that overrides the default receive/send buffer size used in WebSocketsProxyMiddleware.

Actual Behavior / Motivation for New Feature

The buffer size in WebSocketsProxyMiddleware is hardcoded to 4096 bytes. This causes choppy/degraded video streams over WebSocket connections when hosting with HTTP.sys. HTTP.sys is more sensitive to small receive buffers than Kestrel due to differences in kernel-level I/O handling — 4096 bytes is insufficient for high-bandwidth routes such as video streaming.

Steps to Reproduce the Problem

  1. Host Ocelot with HTTP.sys (not Kestrel)
  2. Configure a WebSocket route proxying a video stream
  3. Observe choppy/degraded stream quality caused by the 4096-byte buffer limit

Specifications

  • Version: 25.0
  • Platform: .NET 10, Windows (HTTP.sys)
  • Subsystem: WebSockets