0

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.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
  • https://lists.qt-project.org/pipermail/development/2013-October/013710.html – Mohammad Kanan Sep 18 '19 at 09:03
  • "wss" is the URI scheme for WebSocket over TLS (the not so new name for SSL). Just like "https" is HTTP over TLS. So in fact you are using a secure channel (the spec can be found here: https://tools.ietf.org/html/rfc6455#section-11.1.2). – Rolf Winter Sep 18 '19 at 12:56
  • I saw that post, but it doesn't really bring up using a normal web socket vs the QSslSocket and the benefits. Rolf - I'm aware wss is secure, but what's the difference in using wss with a QWebSocket vs QSslSocket? If the communication is secured with wss over a QWebSocket, is there any advantage to moving to QSslSocket? – Katie Sanderson Sep 18 '19 at 14:39

1 Answers1

0

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.

eugesh
  • 111
  • 5