[Development] QWebsocket remark
Kurt Pattyn
pattyn.kurt at gmail.com
Wed Feb 19 08:14:21 CET 2014
Hi Martin,
> On 17 Feb 2014, at 19:39, Martin Koller <kollix at aon.at> wrote:
>
> Hi,
>
> had a quick look into the implementation as I wanted to use it in my existing webserver.
> However, the API does not provide a way to use it for an _existing_ tcp communication channel.
Do you mean a QTcpSocket?
>
> What would be great is if you modify QWebSocketDataProcessor in some way so that it just
> get's data from anywhere and therefore also make it a public class.
Well, it takes a QIODevice as data source, so that shouldn't be a problem (as you stated yourself).
As you probably know, there is a feature freeze for Qt 5.3; so changing the API is currently not a good idea.
Instead of making QWebSocketDataProcessor public, could you live with the (now private) upgradeFrom() method? This method is actually taking a QTcpSocket and 'upgrades' it to a QWebSocket.
Do you process the handshake yourself? The dataprocessor only takes care of data after a successful handshake has been exchanged.
It is however a very interesting use case and should definitely be explored further.
Can you add a feature request in Jira?
>
> I see it's currently reading from an QIODevice which should be ok, but what is unfortunate
> is that QWebSocketFrame::readFrame(pIoDevice); blocks!
>
> The problem is exactly what you already wrote as comment there:
> case PS_WAIT_FOR_MORE_DATA:
> //TODO: waitForReadyRead should really be changed
> //now, when a websocket is used in a GUI thread
> //the GUI will hang for at most 5 seconds
> //maybe, a QStateMachine should be used
I know, I will finetune this when I start with stress tests. Expect this to be changed in an upcoming release.
Cheers,
Kurt
>
> --
> Best regards/Schöne Grüße
>
> Martin
>
> A: Because it breaks the logical sequence of discussion
> Q: Why is top posting bad?
>
> () ascii ribbon campaign - against html e-mail
> /\ - against proprietary attachments
>
> This mail was not scanned before sending.
> It was sent from a secure Linux desktop.
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
More information about the Development
mailing list