简体   繁体   中英

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM