Network API v1.1 — Settings, Variables and Delivery Modes
This document defines exactly how Network API subscription variables are interpreted and in what order they are applied.
API: beanalyzer.network.v1 Revision: 1.1 Scope: subscription filtering and telemetry delivery Status: IMPLEMENTED / CI TESTED
This document defines exactly how Network API subscription variables are interpreted and in what order they are applied.
1. Processing pipeline
For every published event, the server processes a subscription in this order:
source event
|
v
1. stream filter
|
2. direction filter
|
3. BEAN / CAN identifier filters
|
4. requested signal-name filter
|
5. per-signal delivery policy
mode
deadband
update frequency / min interval
heartbeat
|
6. signal batching
|
7. event/signal field projection
|
8. output encoding
JSON
compact JSON
binary
|
v
clientThis order matters.
For example, a signal excluded by signals:[...] never reaches deadband, batching or encoding.
2. Complete subscription-variable reference
| Variable | Type | Default | Scope | Meaning |
|---|---|---|---|---|
type | string | required | command | Use "subscribe" |
request_id | any JSON scalar | omitted | command | Echoed in acknowledgement/errors |
streams | string/list | all 3 streams if empty | filter | bean, can, signals |
directions | string/list | no direction filter | filter | Usually RX, TX |
signals | string/list | all decoded signals | signal filter | Exact decoded signal names |
bean | object | no BEAN ID filter | BEAN filter | Context/DID/MID selectors |
can | object | no CAN ID filter | CAN filter | CAN ID selectors |
profile | string | standard | delivery | standard or low |
low_profile | bool | false | delivery | Convenience alias selecting low |
format | string | profile-dependent | encoding | json, compact_json, binary |
output_format | string | profile-dependent | encoding | Alias of format |
mode | string | profile-dependent | delivery | Delivery policy |
update_hz | number | profile-dependent | rate | Maximum update frequency |
update_frequency_hz | number | profile-dependent | rate | Alias of update_hz |
frequency_hz | number | profile-dependent | rate | Alias of update_hz |
min_interval_ms | number | derived / 0 | rate | Minimum time between emitted values |
heartbeat_ms | number | 1000 | delivery | Stable-value resend interval in heartbeat mode |
deadband | number/object/bool | disabled | change filter | Threshold and optional offset |
deadband_enabled | bool | absent | change filter | Explicit global enable/disable |
deadband_value | number | 0 when needed | change filter | Threshold used with boolean enable |
deadband_offset | number | 0 | change filter | Shifts deadband centre |
batch_ms | number | profile-dependent | packet reduction | Signal accumulation window |
numeric_ids | bool | profile-dependent | encoding | Use deterministic 32-bit signal IDs |
event_fields | list[string] | all / profile-dependent | projection | Requested top-level event metadata |
signal_fields | list[string] | all / profile-dependent | projection | Requested fields inside signal objects |
fields | list[string] | absent | projection | Alias of signal_fields |
signal_options | object | empty | per-signal | Per-signal mode/rate/deadband overrides |
ttl_s | integer | 60 | UDP only | Subscription lifetime, clamped to 5..3600 s |
3. Profile defaults
3.1 Standard
{
"profile":"standard"
}Effective defaults:
format = json
mode = every_update
update_hz = unlimited
min_interval_ms = 0
heartbeat_ms = 1000
batch_ms = 0
deadband = disabled
deadband_offset = 0
numeric_ids = false
event_fields = all
signal_fields = allThis is the backwards-compatible API behavior.
3.2 Low
{
"profile":"low"
}or:
{
"low_profile":true
}Effective defaults:
format = compact_json
mode = on_change_heartbeat
update_hz = 10
min_interval_ms = 100
heartbeat_ms = 1000
batch_ms = 100
deadband = disabled
deadband_offset = 0
numeric_ids = true
event_fields = type,stream,sequence,signals
signal_fields = id,valueImportant: low profile does not enable deadband automatically.
4. Precedence rules
The effective configuration is built in layers.
Global layer
built-in defaults
↓
profile defaults
↓
explicit subscription fieldsExample:
{
"profile":"low",
"format":"json",
"update_hz":20,
"batch_ms":0
}Although low normally chooses compact JSON at 10 Hz with 100 ms batching, this request becomes:
format = json
update_hz = 20
batch_ms = 0Per-signal layer
For a decoded signal:
effective global settings
↓
signal_options.<signal name>Example:
{
"profile":"low",
"streams":["signals"],
"signals":["rpm","coolant_temp"],
"signal_options":{
"rpm":{"update_hz":20,"deadband":25},
"coolant_temp":{"update_hz":1,"deadband":1}
}
}The exact signal name is used as the lookup key.
5. Delivery modes
5.1 every_update
Every source update that survives filters is eligible for transmission.
{
"mode":"every_update"
}With no rate limit:
source event -> emit
source event -> emit
source event -> emitWith update_hz or min_interval_ms, updates inside the interval are suppressed.
Example:
{
"mode":"every_update",
"update_hz":10
}means an emitted value can occur at most every 100 ms for that state key.
5.2 on_change
An event is eligible only when its value differs from the last accepted / emitted reference value.
{
"mode":"on_change"
}With deadband disabled, normal equality comparison is used.
With a rate limit, a changed sample can still be suppressed by min_interval_ms. In that case the reference is not advanced, so a later sample is still compared against the last emitted reference.
5.3 on_change_heartbeat
Combination of change-triggered delivery and stable-value keepalive.
{
"mode":"on_change_heartbeat",
"heartbeat_ms":1000
}Behavior:
changed value -> eligible immediately
stable value -> normally suppressed
stable value -> eligible after heartbeat_msThe normal minimum interval still applies.
Important: heartbeat is evaluated when new source events arrive. The current implementation does not synthesize a signal sample from nothing. If the source itself stops producing that signal entirely, no independent heartbeat packet is created for it.
5.4 periodic
Ignores change state and emits only when the effective minimum interval has elapsed.
{
"mode":"periodic",
"update_hz":2
}or:
{
"mode":"periodic",
"min_interval_ms":500
}As with heartbeat, periodic delivery is driven by incoming source events. It is not a synthetic timer that recreates values when the source is silent.
6. Update-frequency variables
Three frequency names are accepted:
"update_hz":10"update_frequency_hz":10"frequency_hz":10They describe the same setting.
Conversion:
min_interval_ms = 1000 / update_hzExamples:
| Frequency | Effective interval |
|---|---|
| 50 Hz | 20 ms |
| 20 Hz | 50 ms |
| 10 Hz | 100 ms |
| 5 Hz | 200 ms |
| 2 Hz | 500 ms |
| 1 Hz | 1000 ms |
If min_interval_ms is explicitly supplied, it overrides the frequency form for interval calculation.
{
"update_hz":20,
"min_interval_ms":200
}effective behavior:
min_interval_ms = 200
effective maximum rate ≈ 5 HzA non-positive frequency disables the frequency-derived interval.
7. Deadband
Deadband is optional and disabled by default.
Shorthand
{
"deadband":5
}Object form
{
"deadband":{
"enabled":true,
"value":5,
"offset":0
}
}Boolean control
{
"deadband_enabled":true,
"deadband_value":5
}Disable explicitly:
{
"deadband_enabled":false
}or:
{
"deadband":{"enabled":false}
}A deadband value of zero behaves like exact change detection.
8. Deadband calculation and offset
For numeric values:
L = last emitted/reference value
N = new value
D = deadband threshold
O = deadband_offset
delta = N - L
significant change when:
abs(delta - O) >= DSymmetric example
L = 100
D = 5
O = 0Values whose absolute delta remains below 5 are suppressed.
Offset example
L = 100
D = 5
O = +2The comparison is centred around a +2 shift relative to the last emitted value.
Approximate no-send window:
97 < N < 107The exact threshold boundary is emitted because the comparison uses >= D.
Example:
{
"mode":"on_change",
"deadband":5,
"deadband_offset":2
}The offset can be useful for deliberately asymmetric hysteresis.
For non-numeric values, deadband magnitude is not applied; normal inequality is used.
9. Per-signal options
signal_options applies only to decoded signals stream items.
Example:
{
"type":"subscribe",
"streams":["signals"],
"signals":["rpm","speed","coolant_temp"],
"profile":"low",
"signal_options":{
"rpm":{
"mode":"on_change_heartbeat",
"update_hz":20,
"heartbeat_ms":1000,
"deadband":25,
"deadband_offset":5
},
"speed":{
"update_hz":10,
"deadband":1
},
"coolant_temp":{
"update_hz":1,
"deadband":1,
"heartbeat_ms":5000
}
}
}Accepted per-signal override fields:
mode
update_hz
update_frequency_hz
frequency_hz
min_interval_ms
heartbeat_ms
deadband
deadband_enabled
deadband_value
deadband_offsetFormat, batching and field projection are subscription-wide rather than per-signal.
10. Batching
batch_ms is implemented for the signals stream.
Example:
{
"batch_ms":100
}During the batch window, BEANalyzer stores the latest signal object for each signal name.
Example source sequence:
0 ms rpm=900
20 ms speed=25
40 ms rpm=930
70 ms coolant_temp=90batch result:
rpm=930
speed=25
coolant_temp=90The older rpm=900 sample is replaced inside the pending batch.
Current batching properties:
- applies to
signalsonly; batch_ms <= 0disables it;- keeps the latest value per signal name;
- top-level batch metadata follows the latest event added to the pending batch;
- batches are checked/flushed by the Network API selector loop;
- the selector loop normally wakes at approximately 50 ms cadence, so actual
emission may occur slightly after the exact requested batch boundary;
- CAN and BEAN raw event streams are not combined by this signal batcher.
11. Filters
11.1 Stream filter
{
"streams":["signals"]
}Allowed:
signals
bean
canIf streams is omitted or empty, all three are selected.
11.2 Direction
{
"directions":["RX"]
}The filter is case-normalized to uppercase.
If no direction filter is supplied, both directions are eligible when published.
11.3 Signal names
{
"signals":["rpm","speed","coolant_temp"]
}Names are exact string names produced by the active BEAN-DBC.
Use list_signals to discover them.
11.4 BEAN routing fields
Plural:
{
"bean":{
"contexts":["0x53"],
"dids":["0xFE"],
"mids":["0x24"]
}
}Singular aliases:
{
"bean":{
"context":"0x53",
"did":"0xFE",
"mid":"0x24"
}
}All populated BEAN selectors are ANDed.
11.5 CAN IDs
{
"can":{
"ids":["0x520","0x5B4"]
}
}Singular:
{
"can":{"id":"0x520"}
}12. Numeric identifier parsing
Identifier helper parsing accepts:
- JSON integer;
- decimal numeric string;
0x-prefixed hexadecimal string;- a string containing hexadecimal alphabetic digits.
For clarity, hexadecimal identifiers should use 0x.
Recommended:
{"can":{"ids":["0x520","0x5B4"]}}13. Numeric signal IDs
Enable:
{
"numeric_ids":true
}Signal IDs are deterministic:
unsigned CRC32(UTF-8 signal name)Example subscription acknowledgement:
{
"type":"subscribed",
"subscription":{
"delivery":{
"numeric_ids":true,
"signal_ids":{
"rpm":123456789,
"speed":987654321
}
}
}
}Numbers above are illustrative.
list_signals also exposes signal_id.
A 32-bit CRC collision is theoretically possible. A client requiring collision-proof identity should retain signal names or validate its mapping.
Binary format always forces numeric IDs.
14. Event-field selection
Standard JSON
Example:
{
"event_fields":["sequence","source","replay"],
"signal_fields":["name","value"]
}For standard JSON, type and stream are preserved so an event remains self-describing. The signals payload is also produced for a signals event.
Signal fields
Common fields available from decoded signals include:
name
value
unit
kind
raw
raw_bytes
offset
timestamp
context
did
mid
id generated when numeric_ids=trueIf field projection would otherwise remove both name and id, the implementation restores one identifier so the signal is not anonymous.
Alias
"fields":["name","value"]is accepted as an alias for:
"signal_fields":["name","value"]15. Compact JSON
Request:
{
"format":"compact_json"
}Aliases accepted:
compact
compactjson
json_compactCompact top-level keys:
| Key | Meaning |
|---|---|
t | type |
s | stream |
q | sequence |
ts | timestamp |
b | bus |
d | direction |
src | source |
r | replay flag, 0/1 |
c | BEAN context |
di | BEAN DID |
m | BEAN MID |
id | CAN ID |
x | CAN extended flag, 0/1 |
l | DLC |
data | data bytes |
v | signal values |
When signal projection is only identity + value, v is compacted to pairs:
{
"t":"e",
"s":"sig",
"q":100,
"v":[
[123456789,901.5],
[987654321,25]
]
}When additional signal fields are requested, v contains short-key objects.
Compact signal keys include:
i id
n name
v value
u unit
k kind
r raw
rb raw_bytes
o offset
ts timestamp
c context
d did
m mid16. Binary mode
Request:
{
"format":"binary"
}Alias:
binBinary format forces numeric_ids=true.
event_fields and signal_fields do not redefine the fixed binary packet layout. Binary mode uses the protocol-defined compact packet structures documented in [PROTOCOLV11.md](PROTOCOLV11.md).
The JSON control plane remains active for auth, subscribe acknowledgements, status requests and errors.
17. Recommended settings by use case
| Use case | Profile/mode | Suggested rate | Batch | Deadband | Format |
|---|---|---|---|---|---|
| PC diagnostic logger | standard / every_update | unlimited | 0 | off | JSON |
| ESP32 dashboard | low / onchangeheartbeat | 10–20 Hz | 50–100 ms | optional | compact JSON |
| Slow temperature display | low / onchangeheartbeat | 1–2 Hz | 100–250 ms | 1 unit optional | compact JSON |
| Nintendo DS dashboard | low / onchangeheartbeat | 5–10 Hz | 100–200 ms | optional | compact JSON or binary |
| High-efficiency MCU telemetry | custom | signal-dependent | 50–100 ms | optional | binary |
| Filtered raw CAN tool | standard / every_update | source rate | 0 | N/A | binary |
| Filtered raw BEAN tool | standard / every_update | source rate | 0 | N/A | compact JSON or binary |
These are engineering starting points, not hard protocol requirements.
18. Invalid configuration
Invalid mode/profile/format values produce an API error:
{
"api":"beanalyzer.network.v1",
"type":"error",
"error":"invalid_subscription",
"detail":"..."
}The server remains running.
19. Worked example: optimized dashboard
Request:
{
"type":"subscribe",
"request_id":100,
"profile":"low",
"streams":["signals"],
"signals":["rpm","speed","coolant_temp"],
"mode":"on_change_heartbeat",
"update_hz":10,
"heartbeat_ms":1000,
"batch_ms":100,
"deadband_enabled":false,
"format":"compact_json",
"numeric_ids":true,
"event_fields":["sequence","source","replay"],
"signal_fields":["id","value"],
"signal_options":{
"rpm":{
"update_hz":20,
"deadband":25,
"deadband_offset":5
},
"speed":{
"update_hz":10,
"deadband":1
},
"coolant_temp":{
"update_hz":1,
"deadband":1,
"heartbeat_ms":5000
}
}
}Interpretation:
1. accept only signals stream
2. keep only rpm/speed/coolant_temp
3. start from low-profile defaults
4. global max rate becomes 10 Hz
5. global batch window remains 100 ms
6. global deadband is explicitly disabled
7. rpm override:
20 Hz
deadband 25
offset +5
8. speed override:
10 Hz
deadband 1
9. coolant override:
1 Hz
deadband 1
5 s heartbeat
10. batch latest accepted signal samples
11. encode compact JSON
12. identify signals by 32-bit numeric IDThis example demonstrates that rate/deadband decisions occur per signal before the accepted values enter the batch.
20. Accepted aliases and normalization
The implementation normalizes selected user-facing values before validation.
Profile aliases
All of these select the low profile:
low
low_resource
lowresource
optimized
optimisedlow_profile:true also selects low when an explicit profile is not supplied.
Format aliases
json:
json
full
full_json
normal
compact_json:
compact_json
compact
compactjson
json_compact
binary:
binary
binHyphens are normalized to underscores before matching.
Mode aliases
every_update:
every_update
all
every
always
on_change:
on_change
onchange
change
on_change_heartbeat:
on_change_heartbeat
onchange_heartbeat
change_heartbeat
heartbeat
periodic:
periodic
fixed
frequencyHyphens are normalized to underscores before matching.
21. Scope differences: signals vs raw BEAN/CAN
Not every delivery option has the same meaning on every stream.
| Option | signals | CAN | BEAN |
|---|---|---|---|
| stream/entity filters | yes | yes | yes |
mode | yes | yes | yes |
update_hz / min_interval_ms | yes | yes | yes |
heartbeat_ms | yes | yes | yes |
| numeric deadband | yes | no | no |
signal_options | yes | no | no |
batch_ms | yes | no | no |
signal_fields | yes | N/A | N/A |
event_fields | yes | JSON/compact projection | JSON/compact projection |
| compact JSON | yes | yes | yes |
| binary | yes | yes | yes |
For raw CAN, change state is based on the CAN ID's data tuple.
For raw BEAN, change state is based on Context/DID/MID and DATA/raw-frame content.
Numeric deadband is intentionally applied only to decoded signal values.
22. First-sample behavior
The first value seen for a state key is emitted immediately and establishes the reference value/time.
This is true even when a rate limit has been configured.
After that first emission, normal mode/deadband/minimum-interval logic applies.
23. JSON projection details
Full JSON
When event_fields is empty, the complete event is copied.
When event_fields is populated:
- only requested top-level fields are selected;
typeis restored if present;streamis restored if present;- for
signalsevents, the projectedsignalsarray is produced.
Full JSON also adds the canonical:
"api":"beanalyzer.network.v1"if it is not already present.
Compact JSON
Compact JSON always emits at least:
t = type
s = streamand emits the compact signal payload v for signal events.
event_fields controls optional metadata such as sequence/source/replay.
If signal_fields is empty or contains only identity/value fields, compact signals use pair form:
[[id_or_name,value], ...]To retain unit/raw/kind/etc. in compact JSON, request those fields explicitly; the encoder then uses short-key signal objects.
Binary
Binary packet layouts are fixed by the protocol. JSON field-projection lists do not alter binary packet structure.
24. UDP authentication nuance
UDP has no persistent connection object.
A token may be included directly in a UDP command:
{
"type":"get_status",
"token":"YOUR_TOKEN"
}or in a subscribe datagram.
Once an authenticated UDP subscription exists for the source IP/port endpoint, that endpoint is treated as authenticated until the subscription expires.
A standalone UDP auth request can return a successful authentication reply, but it does not by itself create a persistent authenticated UDP session. For persistent UDP use, authenticate as part of subscribe or include the token in individual commands.
25. Effective settings acknowledgement
A client should treat the subscribed response as the authoritative effective configuration.
Example:
{
"type":"subscribed",
"subscription":{
"streams":["signals"],
"signals":["rpm"],
"delivery":{
"profile":"low",
"format":"compact_json",
"mode":"on_change_heartbeat",
"update_hz":10.0,
"min_interval_ms":100.0,
"heartbeat_ms":1000.0,
"deadband":{
"enabled":false,
"value":null,
"offset":0.0
},
"batch_ms":100.0,
"numeric_ids":true,
"event_fields":["sequence","signals","stream","type"],
"signal_fields":["id","value"],
"signal_ids":{
"rpm":123456789
}
}
}
}The numeric ID above is illustrative.
Reading the acknowledgement is preferable to reproducing profile-default logic inside every client.