Send want_config_id on connect to trigger initial sync #6

Merged
kamilkrzywda merged 1 commits from feat/want-config-on-connect into main 2026-09-23 22:42:04 +02:00
Owner

Problem

GET /api/channels always returned [] and /api/status kept myNodeNum: null even with the bridge connected. Root cause (client-side, not device): the service wrote nothing on connect, and Meshtastic firmware only streams initial sync data (myInfo, nodeInfos, channels, configCompleteId) after receiving a ToRadio with want_config_id. All official clients send it right after connecting; we didn't.

Change

  • codec.ts — new buildWantConfigToRadio(wantConfigId) (verified oneof case "wantConfigId" against installed @meshtastic/protobufs)
  • mesh.service.ts — on socket connect: random non-zero uint32 nonce → framed want-config ToRadio written to the bridge; existing handlers (myInfo / configCompleteId / channel / packet) already consume the resulting stream, untouched
  • spec: new test captures the first outbound frame, decodes it as ToRadio (want-config case, value > 0), then feeds back myInfo + configCompleteId and asserts status().myNodeNum is set; fixed the send-test helper to scan all outbound frames (first frame is now want_config)

Verification

  • npm run build ✓
  • npm test — 13/13 passed (was 12, +1 new)
  • v0.1.4, CHANGELOG entry added
## Problem `GET /api/channels` always returned `[]` and `/api/status` kept `myNodeNum: null` even with the bridge connected. Root cause (client-side, not device): the service wrote **nothing** on connect, and Meshtastic firmware only streams initial sync data (myInfo, nodeInfos, channels, configCompleteId) after receiving a ToRadio with `want_config_id`. All official clients send it right after connecting; we didn't. ## Change - `codec.ts` — new `buildWantConfigToRadio(wantConfigId)` (verified oneof case `"wantConfigId"` against installed @meshtastic/protobufs) - `mesh.service.ts` — on socket connect: random non-zero uint32 nonce → framed want-config ToRadio written to the bridge; existing handlers (myInfo / configCompleteId / channel / packet) already consume the resulting stream, untouched - spec: new test captures the first outbound frame, decodes it as ToRadio (want-config case, value > 0), then feeds back myInfo + configCompleteId and asserts `status().myNodeNum` is set; fixed the send-test helper to scan all outbound frames (first frame is now want_config) ## Verification - `npm run build` ✓ - `npm test` — 13/13 passed (was 12, +1 new) - v0.1.4, CHANGELOG entry added
kamilkrzywda added 1 commit 2026-09-23 22:38:41 +02:00
Send want_config_id on connect to trigger initial sync
CI / build + unit (pull_request) Successful in 1m9s
95fab10f82
kamilkrzywda merged commit adfbc9800b into main 2026-09-23 22:42:04 +02:00
kamilkrzywda deleted branch feat/want-config-on-connect 2026-09-23 22:42:04 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/MeshBot#6