Trouble with secure websockets
-
Hey,
I working with websockets at the moment based on the Qt examples: http://doc.qt.io/qt-5/qtwebsockets-examples.html
I want to use the secure websockets now (wss) but I have trouble with the webclient.http://doc.qt.io/qt-5/qtwebsockets-sslechoserver-sslechoclient-html.html
if I try to connect to the server, I get the following error:ERROR: undefined DISCONNECTED
The key and cert file are created with openssl, using this 3 commands:
openssl genrsa -out key.pem 2048 openssl req -new -key key.pem -out csr.pem openssl req -x509 -days 365 -key key.pem -in csr.pem -out certificate.pem
So I have no idea why the webclient can't connect. Maybe some handshake error but no idea why. Normal connections (ws://) working, websocket secure (wss://) not.
Also the Echo-Client can connect without any problems.I tested the html file with Edge, Firefox, IE, Chrome, all fail. The browsers should be not the problem, I did the test on http://www.websocket.org/echo.html - working very well.
I hope someone has an idea, I really need a solution for that problem.
-
Hi and welcome to devnet,
What OS are you running ?
-
Do you have OpenSSL-Win64 installed on your computer ?
-
Good, so next thing: did you add the path to the OpenSSL-Win64 dlls to the PATH environment variable in the run settings from the Project panel ? Warning: Don't do it system wide, that's wrong.
-
I didn't.
But also it didn't fixed the error.The QT client can connect to the server with wss.
The Webclient can't connect to the server with wss. But an echo test to "wss://echo.websocket.org" is successfully, so the browser is okay. The question is, what's the difference between Qt secure websocket and the other solutions? Is it may some different SSL/TSL config?
I'm using QSsl::TlsV1SslV3