|
| 1 | +--- |
| 2 | +title: Why add a Device Connect server |
| 3 | +weight: 2 |
| 4 | + |
| 5 | +# FIXED, DO NOT MODIFY |
| 6 | +layout: learningpathall |
| 7 | +--- |
| 8 | + |
| 9 | +## From device-to-device (D2D) to server |
| 10 | + |
| 11 | +The [device-to-device Learning Path](/learning-paths/embedded-and-microcontrollers/device-connect-d2d/) showed Device Connect in its simplest shape. Each runtime is a peer on the same local network. Devices find each other automatically, exchange typed events, and call each other's remote procedure calls (RPCs) directly. There is no broker, registry, or cloud service to run. |
| 12 | + |
| 13 | +That model is useful when everything is close together. It works well for prototypes, lab demos, and small fleets on one local area network (LAN). It is also a good fit when a cloud round-trip would add unnecessary delay. |
| 14 | + |
| 15 | +As soon as the fleet grows, D2D mode starts to run out of road. You may need devices on different networks to talk to each other. You may need a registry that remembers devices after they disconnect. You may also need stronger identity, credential rotation, or audit logs. |
| 16 | + |
| 17 | +Use a Device Connect server when you need: |
| 18 | + |
| 19 | +- a **persistent registry** that survives device reboots and lets new clients list known devices |
| 20 | +- **distributed state** shared between devices and agents, with leases and watches |
| 21 | +- **multi-network reach** for devices and agents on different LANs, behind network address translation (NAT), or in the cloud |
| 22 | +- **fleet-wide operations** such as commissioning devices and rotating credentials |
| 23 | +- **stronger security controls** such as per-device identity, JSON Web Token (JWT) credentials, role-based access control lists (ACLs), and audit logs |
| 24 | + |
| 25 | +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 software development kit (SDK) you already know. |
| 26 | + |
| 27 | +## What the server adds |
| 28 | + |
| 29 | +The server does not change how you write device code. Devices still use `DeviceDriver`, `@rpc`, `@emit`, `@periodic`, and `@on`. Clients and artificial intelligence (AI) agents still use `discover_devices()` and `invoke_device()`. |
| 30 | + |
| 31 | +The server changes how devices find and trust each other. In D2D mode, each runtime discovers nearby peers directly. With a server, every device and agent connects to a shared service. |
| 32 | + |
| 33 | +That shared service gives you a few fleet-level building blocks: |
| 34 | + |
| 35 | +- **routing** so devices on different networks can join the same mesh |
| 36 | +- **registry** so clients can see known devices, their capabilities, and their last-known status |
| 37 | +- **shared state** so devices and agents can coordinate through a common store |
| 38 | +- **commissioning** so each device gets its own trusted credential |
| 39 | +- **security controls** such as Transport Layer Security (TLS), mutual TLS (mTLS), JSON Web Token (JWT) authentication, role-based access control, and audit logging |
| 40 | + |
| 41 | +Device Connect supports different messaging backends, including Zenoh, NATS, and Message Queuing Telemetry Transport (MQTT). In this Learning Path, you will use the hosted portal with NATS credentials. That lets you focus on the device and agent code instead of running the server yourself. |
| 42 | + |
| 43 | +## A note on commissioning |
| 44 | + |
| 45 | +Commissioning means giving a device or agent a trusted identity before it joins the mesh. Without commissioning, a process is just code trying to connect. With commissioning, the server can decide whether that process is allowed to publish, subscribe, register itself, or call an RPC. |
| 46 | + |
| 47 | +The credential format depends on the messaging backend: |
| 48 | + |
| 49 | +- with **Zenoh**, commissioning means issuing the device a client TLS certificate signed by a shared certificate authority (CA) |
| 50 | +- with **NATS**, commissioning means issuing the device a JWT credential bound to its tenant |
| 51 | + |
| 52 | +In both cases, the credential answers the same question: is this identity allowed on this mesh? |
| 53 | + |
| 54 | +In this Learning Path, you will use the [Device Connect portal](https://portal.deviceconnect.dev/) to download NATS credentials for three default identities on your tenant. Two identities will run simulated robot arms. The third identity will run the Python client or agent. |
| 55 | + |
| 56 | +## Where this sits in the architecture |
| 57 | + |
| 58 | +In the diagram, pub/sub means publish/subscribe, KV means key-value, LC means LangChain, and MCP means Model Context Protocol. |
| 59 | + |
| 60 | +``` |
| 61 | +┌──────────────────┐ ┌──────────────────────┐ ┌─────────────────────┐ |
| 62 | +│ Devices │ │ Device Connect │ │ AI agents │ |
| 63 | +│ (edge SDK) │ │ server │ │ (agent-tools) │ |
| 64 | +│ DeviceDriver │◄───►│ Pub/sub · Registry│◄───►│ discover_devices() │ |
| 65 | +│ @rpc @emit │ │ KV · Security│ │ invoke_device() │ |
| 66 | +│ @periodic @on │ │ │ │ Strands / LC / MCP │ |
| 67 | +└──────────────────┘ └──────────────────────┘ └─────────────────────┘ |
| 68 | +``` |
| 69 | + |
| 70 | +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. |
| 71 | + |
| 72 | +The animation below shows the same idea end to end. A Device Connect server runs in Berlin. Robots in San Francisco and Tokyo install `device-connect-edge` and register with it. 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 the server. |
| 73 | + |
| 74 | +<video width="100%" controls muted playsinline> |
| 75 | + <source src="https://raw.githubusercontent.com/kavya-chennoju/arm-learning-path-assets/main/videos/device-connect-server-overview.mp4" type="video/mp4"> |
| 76 | + Your browser does not support the video tag. |
| 77 | +</video> |
| 78 | + |
| 79 | +## What you'll do in this Learning Path |
| 80 | + |
| 81 | +In the rest of this Learning Path you will: |
| 82 | + |
| 83 | +- sign in to the Device Connect portal and identify your tenant slug |
| 84 | +- download credentials for the three default device identities |
| 85 | +- run two simulated robot arms with `device-connect-edge` |
| 86 | +- discover and invoke both devices from a Python client using `device-connect-agent-tools` |
| 87 | +- optionally attach a Strands AI agent to the same tenant |
| 88 | + |
| 89 | +The next section walks through the setup. |
0 commit comments