|
| 1 | +--- |
| 2 | +title: Why add a Device Connect server |
| 3 | +weight: 2 |
| 4 | + |
| 5 | +# FIXED, DO NOT MODIFY |
| 6 | +layout: learningpathall |
| 7 | +--- |
| 8 | + |
| 9 | +## What D2D mode gives you, and where it stops |
| 10 | + |
| 11 | +In device-to-device (D2D) mode, every Device Connect runtime is a peer on the same local network. Devices find each other through the messaging backend's local discovery (Zenoh's multicast scouting, or NATS running in a peer-to-peer configuration), exchange typed events, and call each other's RPCs directly. There is no central process to provision or maintain. |
| 12 | + |
| 13 | +That is a great fit for prototyping, for small fleets on a shared LAN, and for time-sensitive applications where a cloud round-trip would be wasteful. It stops being a great fit when you need any of the following: |
| 14 | + |
| 15 | +- a **persistent registry** that survives device reboots and lets a new client list every device that has ever connected, not just the ones online right this second |
| 16 | +- **distributed state** shared between devices and agents, with leases and watches (for example, "which experiment is each device currently running?") |
| 17 | +- **multi-network reach** for devices and agents on different LANs, behind NAT, or in the cloud |
| 18 | +- **fleet-wide operations** like commissioning new devices, rotating credentials, or auditing every RPC that has ever been issued |
| 19 | +- **security guarantees** beyond TLS on the wire, including per-device cryptographic identity, PIN-based onboarding, role-based ACLs, and audit logs |
| 20 | + |
| 21 | +The [`device-connect-server`](https://github.com/arm/device-connect/tree/main/packages/device-connect-server) package is the layer that adds those capabilities on top of the edge SDK you already know. |
| 22 | + |
| 23 | +## What the server adds |
| 24 | + |
| 25 | +The server runtime ships as a small set of services you run alongside (or instead of) raw D2D scouting: |
| 26 | + |
| 27 | +- a **messaging router** (Zenoh by default; NATS or MQTT as alternatives) so devices on different networks can reach the same mesh |
| 28 | +- a **device registry service** that records every device, its identity, capabilities, and last-known status, in a persistent store |
| 29 | +- an **etcd-backed distributed state store** that any device or agent can read and write through the Python API |
| 30 | +- a **device commissioning flow** with PIN-based onboarding and per-device cryptographic identity (covered later in this Learning Path) |
| 31 | +- optional **security infrastructure**: TLS/mTLS for Zenoh, JWT auth for NATS, role-based access control, audit logging |
| 32 | + |
| 33 | +You can adopt these incrementally: run the dev-mode Docker Compose to get a router and registry running locally with no auth, then layer in TLS or JWT once you have the basics working. |
| 34 | + |
| 35 | +## A note on commissioning |
| 36 | + |
| 37 | +In a serious deployment, no device joins the mesh until it has been **commissioned**, meaning it has been given a cryptographic identity that the server trusts. The shape of that identity depends on the messaging backend: |
| 38 | + |
| 39 | +- with **Zenoh**, commissioning means issuing the device a client TLS certificate signed by a shared CA |
| 40 | +- with **NATS**, commissioning means issuing the device a JWT credential bound to its tenant |
| 41 | + |
| 42 | +In both cases, the credential answers the question "is this device allowed on this tenant's mesh?" and prevents anyone else from impersonating it. In this Learning Path you will use the [Device Connect portal](https://portal.deviceconnect.dev/) to mint NATS credentials for your devices and your agent, then point each runtime at the tenant's NATS server. That replaces the local Docker setup with a hosted server you do not need to operate yourself. |
| 43 | + |
| 44 | +## Where this sits in the architecture |
| 45 | + |
| 46 | +``` |
| 47 | +┌──────────────────┐ ┌──────────────────────┐ ┌─────────────────────┐ |
| 48 | +│ Devices │ │ Device Connect │ │ AI agents │ |
| 49 | +│ (edge SDK) │ │ server │ │ (agent-tools) │ |
| 50 | +│ DeviceDriver │◄───►│ Pub/sub · Registry│◄───►│ discover_devices() │ |
| 51 | +│ @rpc @emit │ │ KV · Security│ │ invoke_device() │ |
| 52 | +│ @periodic @on │ │ │ │ Strands / LC / MCP │ |
| 53 | +└──────────────────┘ └──────────────────────┘ └─────────────────────┘ |
| 54 | +``` |
| 55 | + |
| 56 | +Devices and agents still talk to each other through the same primitives (`@rpc`, `@emit`, `discover_devices`, `invoke_device`). The Device Connect server runs the pub/sub messaging, the persistent registry, the shared key-value store, and the security layer in one place. |
| 57 | + |
| 58 | +The animation below shows the same idea end to end: a Device Connect server runs in Berlin (with Zenoh, NATS, or MQTT as the messaging backend), robots in San Francisco and Tokyo install `device-connect-edge` and register with it, and an AI agent in Bangalore installs `device-connect-agent-tools` and drives both robots through the server. Every `invoke_device` call and every event flows through Berlin. |
| 59 | + |
| 60 | +<video width="100%" controls muted playsinline> |
| 61 | + <source src="https://raw.githubusercontent.com/kavya-chennoju/arm-learning-path-assets/main/videos/device-connect-server-overview.mp4" type="video/mp4"> |
| 62 | + Your browser does not support the video tag. |
| 63 | +</video> |
| 64 | + |
| 65 | +## What you'll do in this Learning Path |
| 66 | + |
| 67 | +In the rest of this Learning Path you will: |
| 68 | + |
| 69 | +- start the server stack locally with Docker Compose |
| 70 | +- connect a simulated number-generator device to it |
| 71 | +- discover the registered device from a short Python client using `device-connect-agent-tools` |
| 72 | +- attach a Strands AI agent that subscribes to events on the mesh |
| 73 | + |
| 74 | +The next section walks through the setup. |
0 commit comments