[Development] QWebSockets: Advice wanted on API

Thiago Macieira thiago.macieira at intel.com
Sun Oct 27 11:35:36 CET 2013


On domingo, 27 de outubro de 2013 11:07:39, Kurt Pattyn wrote:
> Hi,
> 
> I would like to add secure sockets support to the QWebSocket class (see
> QtWebSockets add-on at https://qt.gitorious.org/qtplayground/websockets).
> Currently, a connection is made to a web socket server, as follows:
> QWebSocket webSocket;
> 	webSocket.open(QUrl(“ws://someserver”));
> 
> Internally, a QTcpSocket is created to set up the connection.
> 
> Now, I have 3 options to add secure web sockets:
> 1. Use a QSslSocket internally when the scheme of the URL is wss.
> This would imply that all or most of the SSL related functionality of
> QSslSocket should be exposed from the QWebSockets class
> (addCaCertificate(), …), making the QWebSocket API quite humongous.

That's what QSslConfiguration is for. No cluttering the API, just two 
functions.

> 3. Use an IOC principle
> Supply a QTcpSocket or a QSslSocket to the constructor of QWebSocket.

That might be interesting, depending on whether we want a pre-connected 
socket. But it shouldn't be the default way that people would use to connect.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131027/2e83965d/attachment.sig>


More information about the Development mailing list