Push live values in realtime over the cloud socket.io feed #11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/realtime-socketio"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Realtime socket.io feed as the primary source of live values
Polling on an interval steps right over dosing pumps that run in short bursts of a few seconds. The vendor cloud pushes every change over a socket.io (Engine.IO v4) feed, so this subscribes to it and publishes changes the moment the controller reports them.
What's new
internal/realtime— Engine.IO v4 / socket.io client over websocket to the/harmopoolnamespace, authenticated with the sameconnect.sidsession cookie. Reconnects with backoff.watchChangesper domain +activeDevicefor every pump —watchChangesalone only sees a relay every ~35–110s;activeDevicebrings it to ~10s (the fastest the hardware telemeters). Both pumps stream at once on one socket.calibrationfromgetInfo.Wiring
getStatsstays on as a seldom backfill (WIFIPOOL_REALTIME_BACKFILL_INTERVAL, default 15m) plus one baseline poll at startup.WIFIPOOL_REALTIME_STALE_AFTER); a realtime update counts as a successful poll for readiness.Config
WIFIPOOL_REALTIME_ENABLED/_STALE_AFTER/_PUBLISH_INTERVAL/_BACKFILL_INTERVAL/_ACTIVE_DEVICES, validated and documented in.env.exampleand the README. SetWIFIPOOL_REALTIME_ENABLED=falsefor the previous pure-polling behaviour.Docs
docs/wifipool-api.mdrewritten as a standalone reference covering both the HTTP and realtime APIs.Verification
Verified live against a real installation: pump
powertransitions captured within ~10s, connection stable past the 30s drop point, calibration correct (pH 7.2, redox 544 mV).go build,go test ./...,-race, andgolangci-lint v2.12.2all clean. CI green on the feature branch.