[Interest] QWebSocket flow control?

Thiago Macieira thiago.macieira at intel.com
Tue Dec 15 09:45:55 CET 2015


On Monday 14 December 2015 16:54:53 Nesuan Taiso wrote:
> 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.

Then you're doing it wrong. If you want to send real-time content, use a real-
time protocol like RTP. WebRTC specifies a different transport protocol than 
websockets.

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

Neither of which are goals of websocket. You're asking for a datagram-based 
protocol, like RTP.

> 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).

That's one way, but if I were you I'd implement RTP/RTCP using QUdpSocket.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list