[Interest] QWebSocket flow control?

Nesuan Taiso nesuan23 at gmail.com
Mon Dec 14 06:54:53 CET 2015


How can I determine the amount of queued (unsent) data in a QWebSocket?

Why do I want to know this? Well for example, let's say I'm trying to 
send real-time video over websocket.

My priorities are (highest to lowest):
1) Minimum possible latency (no more than unloaded ping roundtrip).
2) Send as much data as possible.

If I was trying to do something similar over a QIODevice (like 
QTcpSocket) I would just connect to QIODevice::bytesWritten and write 
some more data whenever QIODevice::bytesToWrite is 0. In this way no 
buffers will ever fill up (and introduce unwanted delays) but I still 
send the best video quality possible (given the available bandwidth).

Even though QWebSocket implements QWebSocket::bytesWritten it does not 
appear to implement anything like QIODevice::bytesToWrite so I have no 
way of knowing if the buffer is empty or not and whether or not I should 
write more data.

Why doesn't QWebSocket have something like QIODevice::bytesToWrite? Is 
there some other technique I can use to achieve my objective?

I am a newbie so it is quite possibly just something simple I 
overlooked, any help appreciated!




More information about the Interest mailing list