mirror of
https://github.com/ruvnet/RuView
synced 2026-08-01 19:01:42 +00:00
feat(homecore-api): negotiate modern websocket clients
This commit is contained in:
@@ -381,6 +381,7 @@ pub async fn compatibility(
|
|||||||
"states_services_config": "implemented",
|
"states_services_config": "implemented",
|
||||||
"events": "implemented",
|
"events": "implemented",
|
||||||
"render_template": "implemented",
|
"render_template": "implemented",
|
||||||
|
"feature_negotiation_and_panels": "implemented",
|
||||||
"registries": "requires_registry_backend",
|
"registries": "requires_registry_backend",
|
||||||
"lovelace_media": "integration_dependent"
|
"lovelace_media": "integration_dependent"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,6 +240,12 @@ impl Connection {
|
|||||||
|
|
||||||
async fn handle_cmd(&self, cmd: WsCommand, tx: &tokio::sync::mpsc::Sender<String>) {
|
async fn handle_cmd(&self, cmd: WsCommand, tx: &tokio::sync::mpsc::Sender<String>) {
|
||||||
match cmd.kind.as_str() {
|
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" => {
|
"ping" => {
|
||||||
let msg = serde_json::json!({"id": cmd.id, "type": "pong"});
|
let msg = serde_json::json!({"id": cmd.id, "type": "pong"});
|
||||||
let _ = tx.try_send(msg.to_string());
|
let _ = tx.try_send(msg.to_string());
|
||||||
@@ -258,6 +264,11 @@ impl Connection {
|
|||||||
});
|
});
|
||||||
self.ack(tx, cmd.id, true, Some(payload));
|
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" => {
|
"get_services" => {
|
||||||
let services = self.state.homecore().services().registered_services().await;
|
let services = self.state.homecore().services().registered_services().await;
|
||||||
let mut by_domain: std::collections::HashMap<
|
let mut by_domain: std::collections::HashMap<
|
||||||
|
|||||||
Reference in New Issue
Block a user