Repository navigation
StatePublisher: rateHz 0 removes a subscription; subscriptions removed when their connection has gone - #13
Merged
Merged
Conversation
…d when their connection has gone - A subscription update (or createSubscription) with rateHz 0 removes the subscription, as documented and as raftjs uses it (on disconnect, and the dashboard's camera panel to stop live view). It was kept with a rate of 0, which made every check a heartbeat, so it published as fast as minMs allowed. - A subscription whose channel reports no connection when a publish is attempted (a websocket with no client in its slot, BLE with no central) is removed, rather than backed off and kept. A websocket channel belongs to a connection slot, so the next client in the slot got the old subscription's publishes without subscribing (and a camera kept capturing for it). Clients subscribe again when they connect (raftjs does). Channels that don't report connections (serial, MQTT) keep theirs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A WebSocket client that never subscribed was receiving camera frames. Two causes:
rateHz: 0didn't disable a subscription. It kept it with a rate of 0, so the interval between heartbeat publishes was 0 ms and every check published (as fast asminMsallows). The wiki documents 0 as "disable", and raftjs relies on it: it sendsrateHz: 0on disconnect, and the dashboard's camera panel sends it to stop live view. An update withrateHz0, orcreateSubscription()with rate 0, now removes the subscription.Tested
Plant growth board (ESP32-S3, camera) over WebSockets:
rateHz: 0, then closedA subscribed client still gets frames at its rate: 12 in 6 s at 2 Hz. The board logs
loop removed subscription topic Camera channelID 2 (no connection)when a subscription is removed.Not tested here: a BLE reconnect. raftjs subscribes again on connect, so this shouldn't change anything for it.
🤖 Generated with Claude Code