TCP Ingest Server — Connection & Poll-Cycle Flow
Companion diagram to asyncapi.yaml (its device-facing
dtu/* and modbus/* channels). Renders natively on GitHub and any
Mermaid-aware viewer. For the frontend-facing WebSocket API, see
WebSocket integration.
Full connection lifecycle
Notes:
- Without a device database configured, identification and pairing are skipped entirely: every connection is an unregistered session (heartbeats only — no telemetry is polled or published).
- A remote-control write (
modbus/register-write) or read (modbus/register-read) requested byws-gateway, and an immediate telemetry pull requested when a client starts watching, all run inside the "wait for next tick" step, on the same goroutine that owns the socket. An immediate pull first sends a heartbeat if the last one is more than 10s old, and is skipped if the device's last reading is still current for its cadence. - An operator-requested disconnect (revoke, delete, re-resolve after registration) is acted on right after the next heartbeat.
Per-request round trip (applies to every channel in asyncapi.yaml's device section)
Every Modbus request/response pair above — health-check, serial-read,
batch-discovery, telemetry-batch, register reads and writes — goes through
this same round trip and correlation logic. The AT commands (dtu/*) use
the same deadlines and stale-reply draining, but are validated by their
reply prefix instead of CRC/correlation.