From 85e77d34cb81f9fe2663c3b7c5a8c2cb0439f82a Mon Sep 17 00:00:00 2001 From: Sijmen Date: Tue, 25 Apr 2023 18:46:21 +0200 Subject: [PATCH] Migrate to SSE extension, make SSE more robust --- src/main.rs | 4 ++++ templates/index.html | 9 +++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 14e8e1b..ddbd907 100644 --- a/src/main.rs +++ b/src/main.rs @@ -126,6 +126,10 @@ async fn sse(_req: tide::Request<()>, sender: tide::sse::Sender) -> tide::Result let mut buffer = String::new(); reader.read_line(&mut buffer).await?; + // Update everything on connect + sender.send("playlist", "", None).await?; + sender.send("player", "", None).await?; + loop { stream.write_all(b"idle playlist player\n").await?; diff --git a/templates/index.html b/templates/index.html index 3875377..14eb60a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,6 +4,7 @@ Empede + @@ -140,7 +141,7 @@ - +
-
-
-
+
+
+