Architecture

Ingress, EventBus,
and live sessions.

Normal MQTT and TCP telemetry uses socket parser state, a bound AuthContext, shared codec/config snapshots, and bounded memory routing. It performs no database, filesystem, remote auth, or control-plane operation on the hot path.

Runtime path

HTTP / MQTT / TCP / UDP devices
          |
          v
transport framing and lifecycle
          |
          v
authentication / ACL / bound AuthContext
          |
          v
versioned DeviceCodec
          |
          v
DeviceEvent(event_id)
          |
          v
bounded EventBus and atomic required-sink admission
          |
          +------ confirmed HTTP webhook
          |
          +------ confirmed framed TCP/RPC stream

Workspace responsibilities

Public client crates depend only on netbaiot-protocol and network libraries. They never depend on runtime, transport, broker, session, or server implementation crates.

netbaiot-protocol

Public wire and domain types, stable errors, paths, and protocol version 1

crates/netbaiot-protocol

netbaiot-client

Business HTTP APIs and confirmed event-stream ownership

crates/netbaiot-client

netbaiot-device-sdk

Optional standard MQTT 3.1.1 and device HTTP convenience client

crates/netbaiot-device-sdk

netbaiot-core

Domain types and the synchronous DeviceCodec trait

crates/netbaiot-core

netbaiot-codecs

Bounded vendor and device protocol codecs

crates/netbaiot-codecs

netbaiot-runtime

Caches, admission, EventBus, sessions, commands, metrics, and restart spool

crates/netbaiot-runtime

netbaiot-transports

HTTP, embedded MQTT 3.1.1, framed TCP, UDP, ACLs, and connection owners

crates/netbaiot-transports

netbaiot-server

Validated composition, business sinks, listeners, recovery, and graceful shutdown

apps/netbaiot-server

netbaiot-cli

Operator interface implemented only through netbaiot-client

apps/netbaiot-cli

Embedded MQTT 3.1.1

The broker implements CONNECT through DISCONNECT, including QoS0, QoS1, and explicit QoS2 state machines. ClientId is not trusted identity. Persistent sessions are keyed by authenticated DeviceKey plus ClientId. MQTT QoS and EventBus delivery are separate contracts.

v1/t/{tenant}/p/{product}/d/{device}/up
v1/t/{tenant}/p/{product}/d/{device}/up_ack
v1/t/{tenant}/p/{product}/d/{device}/down
v1/t/{tenant}/p/{product}/d/{device}/down_ack

Design priorities

There is deliberately no storage crate, SQL migration, database pool, durable outbox, persistent command state, or runtime message history. Business systems own durable business data.