feat(homecore-api): negotiate modern websocket clients

This commit is contained in:
ruv
2026-07-27 14:09:17 -04:00
parent 273bd449c8
commit 3136f1305b
2 changed files with 12 additions and 0 deletions
+1
View File
@@ -381,6 +381,7 @@ pub async fn compatibility(
"states_services_config": "implemented",
"events": "implemented",
"render_template": "implemented",
"feature_negotiation_and_panels": "implemented",
"registries": "requires_registry_backend",
"lovelace_media": "integration_dependent"
}
+11
View File
@@ -240,6 +240,12 @@ impl Connection {
async fn handle_cmd(&self, cmd: WsCommand, tx: &tokio::sync::mpsc::Sender<String>) {
match cmd.kind.as_str() {
"supported_features" => {
// HOMECORE currently emits individual messages. Accepting the
// negotiation command keeps modern HA clients compatible while
// deliberately declining optional coalescing.
self.ack(tx, cmd.id, true, None);
}
"ping" => {
let msg = serde_json::json!({"id": cmd.id, "type": "pong"});
let _ = tx.try_send(msg.to_string());
@@ -258,6 +264,11 @@ impl Connection {
});
self.ack(tx, cmd.id, true, Some(payload));
}
"get_panels" => {
// Panels are frontend integration resources. An empty map is
// the valid shape for a headless server.
self.ack(tx, cmd.id, true, Some(serde_json::json!({})));
}
"get_services" => {
let services = self.state.homecore().services().registered_services().await;
let mut by_domain: std::collections::HashMap<