Using OpenSSL/Secure Websockets with Qt WebAssembly
-
PROBLEM STATEMENT:
Need to create an example Client-Server application using WebAssembly and secure websockets.
Client GUI App:
A simple C++ based GUI based on Qt Webassembly. The Gui pages are served from a webserver
hosted on the same host as the Server App. To launch the client GUI in the web browser we have to use secure protocol (https://).
Once the GUI is launched, it communicates with the Server App by establishing secure wesocket connection and sends messages back and forth.Server App:
Made of a C++ application. This server will listen to Secure Websocket Connections from the client Gui.
Once Wesocket connections are established, it must accept commands from the client and provide response.Client & Server test environment:
Must be built on Ubuntu 22.04
Built using Qt 6.5.0Webassembly Notes:
https://doc-snapshots.qt.io/qt6-6.5/wasm.htmlQt Wesockets Notes:
https://doc-snapshots.qt.io/qt6-6.5/qwebsocket.html
https://doc.qt.io/qt-6/qtwebsockets-examples.htmlWhat is desired:
Qt Example Client project with full source code
Qt Example Server project with full source code
Webserver configuration files and notes. Prefers NGINX webserver
If Qt Webassembly has to be rebuilt from source, Notes with complete qt rebuild instructions.
Notes on how to incorporate Qt's OpenSSL libraries to the Client Gui and how to setup the SSL keys between Client/Server -
So, you want somebody else to do the task for you? And then you will land a nice job? ;-)
Anyway, just wanted to say I did use secure web sockets in WASM in a project a few years ago so it is possible. WASM runs in a browser which already supports Open SSL so using
wss://
simply just works if I recall correctly.Looks like a basic web sockets example from Qt would satisfy the requirements here.
-
@sierdzio In my initial attempt, It looks like the problem I encountered was similar to what the other person described here;
https://forum.qt.io/topic/137581/two-major-problem-that-prevent-qt-webassembly-used-in-real-projectItem #1 in his/her list.
-
@pgmQt
WebAssmebly uses the browsers ssl stack. Just feed to https:// url