What's the difference between using QWebSocket with a URL "wss://..." and QSslSocket in Qt?

461 Views Asked by At

New to Qt. I'm having trouble understanding the difference between using QWebSocket with a secure url, "wss://..." and QSslSocket. Which one of these is necessary to establish secure communication with a server in Qt? Or is something different entirely?

The Qt example "Secure Socket Client Example" uses a normal QWebSocket with "wss://..." but the documentation and what seems intuitive for secure comm is using QSslSocket. Which one should I be using for a secure comm client implementation?

I'm securing my QWebSockets, which are not secured currently, and trying to understand the alternatives and best implementation for secure comm.

1

There are 1 best solutions below

0
eugesh On

This is my first answer on stackoverflow. If you need WSS protocol you may use QWebSocket. If you need HTTPS server you may use QSslSocket and QTcpServer. Or ready to use project e.g. github.com/azadkuh/qhttp, branch dev.

Of course you may implement QWebSocket yourself but only open function contains about 2 pages of code and is based on QSslSocket and QTcpSocket.

Sorry for so late answer but one year ago I wasn't interesting in this.