feat: add public landing and live updates

This commit is contained in:
benya
2026-07-21 03:16:33 +03:00
parent ba09cd7533
commit cd77c12c23
14 changed files with 479 additions and 26 deletions

View File

@@ -0,0 +1,22 @@
package httpapi
import (
"testing"
"time"
)
func TestEventHubPublishesToSubscribers(t *testing.T) {
hub := newEventHub()
updates, unsubscribe := hub.subscribe()
defer unsubscribe()
hub.publish("devices")
select {
case event := <-updates:
if event != "devices" {
t.Fatalf("unexpected event %q", event)
}
case <-time.After(time.Second):
t.Fatal("event was not published")
}
}