Repository navigation
Add configurable WebSocket buffer size per route #2386
Description
Activity
Hello, @erannevo
Yes, it could be configurable.The buffer size in
WebSocketsProxyMiddlewareis hardcoded to 4096 bytes.
This causes choppy/degraded video streams over WebSocket connections when hostingGot it!
We can make the following property protected virtual:
private const int DefaultWebSocketBufferSize = 4096; After that, inherit and override the property that can adjust the buffer size for each route. The injection of a new version of
WebSocketsProxyMiddlewareis another problem.@erannevo Eran?
What's your full name?
What's your LinkedIn profile?
How many years have you been developing .NET apps?- addedfeatureA new featureA new featureWebsocketsOcelot feature: WebsocketsOcelot feature: WebsocketsCoreOcelot Core related or system upgrade (not a public feature)Ocelot Core related or system upgrade (not a public feature)
on Apr 30, 2026 - addedacceptedBug or feature would be accepted as a PR or is being worked onBug or feature would be accepted as a PR or is being worked on
on Apr 30, 2026 Accepted ✅ due to the linked PR #2387
@erannevo Eran? What's your full name? What's your LinkedIn profile? How many years have you been developing .NET apps?
I've replied in the PR comment , I think its best to keep one "chat" active , hard to follow both :)
Reacted by Raman Maksimchuk- added a commit that references this issue
on May 28, 2026 - Reopen due to active PR #2386 Add WebSocketBufferSize per-route configuration #2390
- added a commit that references this issue
on Jul 1, 2026 - addedAutumn'26Autumn 2026 releaseAutumn 2026 releaseand removedNET10.NET 10 release.NET 10 release
on Jul 2, 2026
Expected Behavior / New Feature
Each route should support an optional
WebSocketBufferSizeconfiguration propertythat overrides the default receive/send buffer size used in
WebSocketsProxyMiddleware.Actual Behavior / Motivation for New Feature
The buffer size in
WebSocketsProxyMiddlewareis 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
Specifications