In one application I was streaming jpeg frames over a websocket and by the time the server application experienced backpressure there were 10s of seconds of messages buffered between the server and client. So the message rate would eventually settle into a rate the connection could sustain but messages would take 10+ seconds to reach the client.
Or, perhaps you need to tune the TCP-Window to your application.
I'm sending large messages, ~150 kibibytes, so much larger than a typical internet packet. So I'm not sure Nagle's algorithm is the problem.
> tune the TCP-Window to your application.
This is a possibility. I already had to increase wmem_max to handle fast udp connections.
I'll try to put together a minimal test case when I get the chance.
In my apps i do indeed detect the socket buffers filling, just as you suggest, but pretty much only as a way of detecting completely wedged clients.
You’ll get proper back pressure on websockets with synchronous clients that read messages actively.
This is a browser API spec problem more than a protocol problem.