Skip to main content

Hybrid MQTT + HTTP Sync

Gateway v1 uses a hybrid architecture:

  • MQTT: lightweight control plane
  • HTTP API: full/heavy snapshots

MQTT coordination

  • up/sync/check/AES
  • dn/sync/manifest/AES
  • up/sync/status/AES
  • up/auth/token/request/AES
  • dn/auth/token/response/AES

The API token is short-lived, has a canonical TTL of 8 hours, and must not be persisted to flash.

Snapshot APIs

POST /api/v1/gateway/sync/project-info
POST /api/v1/gateway/sync/users
POST /api/v1/gateway/sync/places
POST /api/v1/gateway/sync/devices
POST /api/v1/gateway/sync/device-definitions
POST /api/v1/gateway/sync/analyzer-rules
POST /api/v1/gateway/sync/scenarios
POST /api/v1/gateway/sync/config

These endpoints are Gateway design contracts; they may not exist in production until Backend implementation is completed.

Flow

Gateway connects MQTT
→ publishes sync/check
→ receives sync/manifest
→ requests API token if needed
→ fetches changed snapshots over HTTPS
→ validates/persists atomically
→ publishes sync/status

A successful HTTP response is the acknowledgement for that snapshot call; no extra MQTT ACK is required.

Last-known-good

A new sync candidate must not replace a healthy cached snapshot before successful validation. Cloud outages do not erase valid local cache.