Qt application running with `-platform offscreen` argument cannot establish websocket connection

Multi tool use
Qt application running with `-platform offscreen` argument cannot establish websocket connection
I have a GUI application which contains a websocket server QWebSocketServer
. I also have a python script which sends messages and the application processes them. Everything works well. During testing I wanted to run the application in headless mode using -platform offscreen
command line argument added to the app executable name (I changed nothing else). But the problem is that when the application runs off-screen, the client script cannot establish connection with the web socket server. I tested this on localhost only. I do not understand how this two things, visibility of GUI and websockets, can interfere. Any ideas what could go wrong?
QWebSocketServer
-platform offscreen
Note: I am using Qt 5.11.1 64-bit with VS 2017 on Windows 10 Pro.
-platform offscreen
1 Answer
1
A platform plugin is a bit more than merely "GUI". The -platform
option selects a family of platform-specific plugins. Perhaps some plugins that make networking work are absent on that platform spec. That's very likely, since the offscreen
platform is only a proof-of-concept: it's to show how you'd write a platform plugin. It's example code, and it does the bare minimum needed. It's nothing that you should be using for production without fully understanding what's there and how it works - it wasn't not meant for it, at least not the last time I looked at it. It shouldn't be hard to make it work, but you'd need to clone the source and start hacking on it.
-platform
offscreen
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I further exploring the issue. I tried the same with another application and it seems to work well even for
-platform offscreen
. I have no idea what difference in the application code caused this.– V.K.
Jul 1 at 11:38