I am using websockets to transfer video-y images from a server, written in Go, to a client which is an HTML page. My experience shared below is with Chrome.
I receive im
I doubt what you are asking for is possible. There is no interface for that functionality in the WebSocket API spec. What the spec does outline, however, is a requirement that the underlying socket connection be managed in the background outside of the script that is using the WebSocket, so that the script is not blocked by WebSocket actions. When the socket receives inbound data, it wraps the data inside of a message and queues it for the WebSocket script to process. There is nothing to block the socket from reading more data while messages remain in the queue waiting for the script to process them.
The only real flow control you can implement in a WebSocket is an explicit one. When a message arrives, send back a message to acknowledge it. Make the server wait to receive that ack before sending its next message.