Add support for receiving data-lake variables through generic web-socket connections#2383
Conversation
There was a problem hiding this comment.
Nice feature - I expect it will be helpful to advanced users, especially for topside software to integrate with Cockpit, and some BlueOS Extensions! :D
In that vein, do you think it's worth adding support for Extensions to list available websocket URLs via the cockpit_extras API, or would it be better to add some kind of event-based advertising support to #2300? At the moment as I understand it users will need to manually set up the websockets, which could be a challenge for some non-technical users, and a bit inconvenient for developers of external software.
I haven't had a chance to test the functionality, but here are some code comments. A couple of minor blockers (🛑), one response (or change) needed (👂), plus some other suggestions.
9946102 to
2442817
Compare
|
@ES-Alexander all suggestions implemented. I actually expect this feature to evolve to be a primary connection point for those who want to use Cockpit with non-MAVLink vehicles. To evolve on that we basically need to add the support for data-lake variables in the dedicated widgets (e.g.: attitude, virtual-horizon, compass, etc). Regarding the setup of the web-socket server, I don't think it's difficult at all. Eight lines of Python and one is good to go. I'm including the test server in the PR as an example, and will push an example BlueOS extension as well, so people know how to configure Docker (the only really stranger part). |
2442817 to
82aced6
Compare
There was a problem hiding this comment.
I tested with a couple of Python servers, and it seems to work well - nice! :-)
Regarding the setup of the web-socket server, I don't think it's difficult at all.
I expect devs will be fine setting up the server, especially with the examples 👍
My concern was/is with users needing to know that they need to (and how to) set up a client connection. That's not hard, but it's extra steps and UX complexity for a software to somehow tell the user they need to set up a web-socket, and how/where to do so, and which address to connect it to.
Ideally an Extension (or other software) could just tell Cockpit (via a dedicated API, and/or cockpit_extras) "I have a websocket for you", and Cockpit would confirm with the user if they want to accept it, and if so create the connection for them automatically (with no manual setup/configuration required).
Not a requirement for this PR (we can raise it as an Issue), just noting that's a desirable feature for user-friendliness.
Got it! Agree that it should enter the cockpit extras at some point. We can do that after we finish the radcam changes. Do you open the issue? |
82aced6 to
800709a
Compare
This PR is very simple although very powerful. It basically allows people to create WebSocket servers, connect Cockpit to them and send data to Cockpit through those servers.
This opens the possibility for users to create BlueOS extensions that send data without using MAVLink.
The data that is received is injected in the data-lake.
The data should come in the following format:
variableName=variableValue. We support all types supported in the data-lake. The server should send a single variable per message. The server can be a Python script as simple as that:The PR includes a testing server, and I'm creating an example BlueOS extension as well. The result from the included test server can be seen below:
Cap.2026-01-30.at.14.16.17.mp4