cleanup: dedupe RESP_CODE_STATS, fix stale publisher.js header, document rfSampler

frames.js declared its own copy of RESP_CODE_STATS = 24, but nothing
imports it — rfstats.js has the copy parseStats actually uses. Delete
the dead one so there is exactly one definition of this wire constant.

publisher.js's header named only the /packets topic, understating the
module's contract now that it also publishes RF samples on /rf.

README's config.json section never documented rfSampler at all (it
exists in public/config.example.json and config.js). Add it alongside
fullRfLog, and warn that mqtt.js negotiates MQTT 3.1.1 — whose PUBACK
carries no reason code — so a broker ACL denying the /rf subtopic
still lets the app log "published N record(s)" while the server
receives zero rows.
This commit is contained in:
efiten committed 2026-08-18 12:43:00 +02:00
1 parent 125eb356f5
commit 770bffdab1
3 files changed
+11 -3

No files matched your search

+9 -1
View File
@@ -100,7 +100,8 @@ Put a `config.json` in the served directory (next to `index.html`). Start from t
"mqttUsername": "coredrive-rx",
"mqttPassword": "<your publish-only EMQX account password>",
"resolveUrl": "https://corescope.yourdomain/api/nodes/resolve",
"fullRfLog": false
"fullRfLog": false,
"rfSampler": false
}
```
> `mqttPassword` is a **publish-only, ACL-constrained** account — it is shipped to browsers, so treat
@@ -111,6 +112,13 @@ Put a `config.json` in the served directory (next to `index.html`). Start from t
> ingestor also has `clientRxObservations.enabled: true`**: with it off, the ingestor decodes and
> discards every one of these packets, writing no row and logging no warning, while `fullRfLog`
> multiplies your normal upload volume. Confirm the ingestor-side flag with your CoreScope sysop
> before turning this on. `rfSampler` is optional (default `false`); when `true`, the app polls the
> companion's own radio counters (noise floor, RX/TX airtime, CRC errors) over local Bluetooth and
> publishes them on `meshcore/client/<pubkey>/rf`. **Enable it only after your broker's ACL permits
> that `/rf` subtopic for this client** — this app negotiates MQTT 3.1.1, whose PUBACK carries no
> reason code, so a publish denied by the ACL is still acknowledged: the app logs `published N
> record(s)` and looks healthy while the server receives zero rows. Confirm the topic is allowed
> (and that the CoreScope ingestor has `clientRfSamples.enabled: true`) with your CoreScope sysop
> before turning this on.
Changing any value later is just a `config.json` edit + page refresh — no rebuild.
-1
View File
@@ -3,7 +3,6 @@
// MAX_FRAME_SIZE=176; no length prefix / no reassembly needed).
export const PUSH_CODE_LOG_RX_DATA = 0x88; // [0x88][snr×4 int8][rssi int8][raw packet...]
export const RESP_CODE_STATS = 24; // [24][sub_type][...] — see rfstats.js
function int8(b) { return b < 128 ? b : b - 256; }
+2 -1
View File
@@ -1,6 +1,7 @@
// Publishes buffered receptions to MQTT (over WebSocket/TLS) in the
// meshcoretomqtt-compatible format CoreScope's ingestor consumes, on the
// client topic meshcore/client/{PUBLIC_KEY}/packets.
// client topics meshcore/client/{PUBLIC_KEY}/packets (receptions) and
// meshcore/client/{PUBLIC_KEY}/rf (RF environment samples).
import mqtt from 'mqtt';
export class Publisher {