> For the complete documentation index, see [llms.txt](https://docs.gapvelocity.ai/webmap-for-blazor-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gapvelocity.ai/webmap-for-blazor-documentation/blazor-ai-migrator/modernization/interfacing-with-hardware-devices.md).

# Interfacing with hardware devices

When moving a desktop application to the web, one of the biggest hurdles is maintaining control over physical equipment. Because modern web browsers have strict security restrictions, they cannot directly access hardware connected to a computer. To overcome this, the Blazor AI Migrator uses an IoT-based architecture to bridge the gap between the cloud and the physical world.

### 🔌 The Hardware Bridge

Since a browser cannot "talk" to a USB port or a local sensor directly, the system uses a local Agent.

* The Agent: This is a small piece of software running on the local computer or an embedded device that physically connects to the hardware.
* The Bridge: The Agent acts as a middleman, taking local hardware data and sending it to the Blazor app in the cloud.
* Remote Control: This setup allows users to control devices and view real-time telemetry even if the hardware is in a completely different facility.

#### 🏗️ Scaling and Routing in the Cloud

When you have thousands of users and devices, the architecture must ensure that the right "Control Command" reaches the right "Machine." This requires a sophisticated cloud routing stack.

| **Component**                 | **Function**                                                                                                                       |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| WebSockets Routing            | Uses Load Balancers with "sticky sessions" to keep a user's browser connected to the specific server handling their session.       |
| Horizontally Scalable Servers | Multiple servers (Server 1 to Server $$ $n$ $$) host individual user sessions, allowing the app to grow as more users join.        |
| Telemetry Routing             | Services like AWS EventBridge or Azure Event Grid act as the "postal service," ensuring data packets find the correct destination. |
| IoT Platforms                 | Hubs (like IoT Core or IoT Hub) manage the secure connection to the remote Agents and devices.                                     |

<figure><img src="/files/PwpdmqyhZiu9ZEHEl6xo" alt=""><figcaption><p>Cloud deployment options for Hardware devices Telemetry/control</p></figcaption></figure>

#### 🌐 Deployment Advantages

* Flexible Pairing: The system supports 1-to-1, many-to-one, or one-to-many pairings between users and devices.
* Enhanced Security: Physical devices do not require public IP addresses to work, as the Agent initiates the secure connection to the cloud.
* Cloud Agnostic: This pattern works across all major providers, including AWS, Azure, and Google Cloud.
