Determining how much data is currently in receive buffer
Determining how much data is currently in receive buffer
I'm using the ws
library on Node for my server. The browser sends a large amount of data to the server over the websocket. I'm finding that it's sometimes too fast and node is running out of memory, I'm assuming because the receive buffer is filling up. I'm trying to find a way to detect how much data is currently in node's receive buffer, so I can implement basic flow control. I'd prefer not to use a solution like websocket-stream, because I'm already multiplexing my control packets and multiple data streams over a single websocket, and I'd prefer not to re-architect the entire system to support multiple separate websocket connections. Also I'd prefer not to be constantly opening and closing websockets.
ws
You can see the source here including a README which describes what the thing does.
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.