Repository: viamrobotics/docs
Pull request #4066: DOCS-3469: Cover mDNS for local connections
Author: login: npentrel
Labels: name: safe to build
description: This pull request is marked safe to build from a trusted zone
Created: 2025-03-11T11:29:05Z | Merged: 2025-03-12T11:14:01Z

@njooma According to the wiki C++ should support mDNS, however I was not able to connect over a local network with C++. Is the wiki wrong or am I missing something for C++? Thanks!


Diff:
diff --git a/docs/dev/reference/sdks/_index.md b/docs/dev/reference/sdks/_index.md
index a1db4339fc..ed3a74240c 100644
--- a/docs/dev/reference/sdks/_index.md
+++ b/docs/dev/reference/sdks/_index.md
@@ -8,7 +8,7 @@ aliases:
   - /sdks/
 ---
 
-### Backend SDKs
+## Backend SDKs
 
 The backend SDKs allow you to build business logic to control [components](/dev/reference/apis/#component-apis) and [services](/dev/reference/apis/#service-apis), as well as manage your [fleet](/dev/reference/apis/fleet/) and [data](/dev/reference/apis/data-client/), and [billing information](/dev/reference/apis/billing-client/), or [provision](/manage/fleet/provision/setup/) machines.
 With the backend SDKs you can also create custom {{< glossary_tooltip term_id="modular-resource" text="modular resources" >}}.
@@ -20,7 +20,7 @@ With the backend SDKs you can also create custom {{< glossary_tooltip term_id="m
 {{< /sectionlist-custom >}}
 <br>
 
-### Frontend SDKs
+## Frontend SDKs
 
 The frontend TypeScript SDK allows you to control your machine's [components](/dev/reference/apis/#component-apis), as well as manage your [data](/dev/reference/apis/data-client/) or [provision](/manage/fleet/provision/setup/) machines.
 
@@ -29,7 +29,7 @@ The frontend TypeScript SDK allows you to control your machine's [components](/d
 {{< /sectionlist-custom >}}
 <br>
 
-### Mobile SDK
+## Mobile SDK
 
 The mobile SDK allows you to build iOS and Android apps to control your machine's [components](/dev/reference/apis/#component-apis), as well as manage your [fleet](/dev/reference/apis/fleet/) and [data](/dev/reference/apis/data-client/), or [provision](/manage/fleet/provision/setup/) machines.
 
diff --git a/docs/dev/reference/sdks/connectivity.md b/docs/dev/reference/sdks/connectivity.md
index 3d6876e782..be0a4436d3 100644
--- a/docs/dev/reference/sdks/connectivity.md
+++ b/docs/dev/reference/sdks/connectivity.md
@@ -1,9 +1,9 @@
 ---
 title: "Client Sessions and Machine Network Connectivity"
-linkTitle: "Network Connectivity Issues"
+linkTitle: "Network Connectivity"
 weight: 80
 type: "docs"
-description: "When a machine loses its connection to a LAN or WAN, all client sessions will timeout and end by default."
+description: "When you connect to a machine, the machine automatically chooses the best connection over local LAN, WAN or the internet."
 tags:
   ["client", "sdk", "viam-server", "networking", "apis", "robot api", "session"]
 aliases:
@@ -15,6 +15,90 @@ date: "2022-01-01"
 
 When connecting to a machine using the connection code from the [**CONNECT** tab](/dev/reference/sdks/), a [client session](/dev/reference/apis/sessions/) automatically uses the most efficient route to connect to your machine either through local LAN or WAN or the internet.
 
+## Connect over local network
+
+To connect directly to the local machine, change the end of the machine address URI from `.viam.cloud` to `.local.viam.cloud` in your machine's connection code.
+The default machine address (URI) from the **CONNECT** tab is of the form `mymachine-main.0a1bcdefgi.viam.cloud`, so `mymachine-main.0a1bcdefgi.local.viam.cloud`.
+
+{{< tabs >}}
+{{% tab name="Python" %}}
+
+```python {class="line-numbers linkable-line-numbers" data-line="10"}
+async def connect():
+    opts = RobotClient.Options.with_api_key(
+        # Replace "<API-KEY>" (including brackets) with your machine's API key
+        api_key='<API-KEY>',
+        # Replace "<API-KEY-ID>" (including brackets) with your machine's
+        # API key ID
+        api_key_id='<API-KEY-ID>'
+    )
+    return await RobotClient.at_address(
+        'mymachine-main.0a1bcdefgi.local.viam.cloud', opts)
+```
+
+{{% /tab %}}
+{{% tab name="Go" %}}
+
+```go {class="line-numbers linkable-line-numbers" data-line="3"}
+machine, err := client.New(
+  context.Background(),
+  "mymachine-main.0a1bcdefgi.local.viam.cloud",
+  logger,
+  client.WithDialOptions(rpc.WithEntityCredentials(
+          /* Replace "<API-KEY-ID>" (including brackets) with your machine's API key ID */
+    "<API-KEY-ID>",
+    rpc.Credentials{
+      Type:    rpc.CredentialsTypeAPIKey,
+              /* Replace "<API-KEY>" (including brackets) with your machine's API key */
+      Payload: "<API-KEY>",
+    })),
+)
+```
+
+{{% /tab %}}
+{{% tab name="TypeScript" %}}
+The TypeScript SDK currently does not support mDNS which means you cannot use it to connect to your machine over a local network.
+{{% /tab %}}
+{{% tab name="Flutter" %}}
+
+```dart {class="line-numbers linkable-line-numbers" data-line="2"}
+Future<void> connectToViam() async {
+  const host = 'mymachine-main.0a1bcdefgi.local.viam.cloud';
+  /* Replace "<API-KEY-ID>" (including brackets) with your machine's API key ID */
+  const apiKeyID = '<API-KEY-ID>';
+  /* Replace "<API-KEY>" (including brackets) with your machine's API key */
+  const apiKey = '<API-KEY>';
+
+  final machine = await RobotClient.atAddress(
+    host,
+    RobotClientOptions.withApiKey(apiKeyID, apiKey),
+  );
+  print(machine.resourceNames);
+}
+```
+
+{{% /tab %}}
+{{% tab name="C++" %}}
+
+```cpp {class="line-numbers linkable-line-numbers" data-line="1"}
+std::string host("mymachine-main.0a1bcdefgi.local.viam.cloud");
+DialOptions dial_opts;
+dial_opts.set_entity(std::string("<API-KEY-ID>"));
+/* Replace "<API-KEY-ID>" (including brackets) with your machine's API key ID */
+Credentials credentials("api-key", "<API-KEY>");
+/* Replace "<API-KEY>" (including brackets) with your machine's API key */
+dial_opts.set_credentials(credentials);
+boost::optional<DialOptions> opts(dial_opts);
+Options options(0, opts);
+
+auto machine = RobotClient::at_address(host, options);
+```
+
+{{% /tab %}}
+{{< /tabs >}}
+
+## Connectivity Issues
+
 When a machine loses its connection to the internet but is still connected to a LAN or WAN:
 
 - Client sessions connected through the same LAN or WAN will function normally.
@@ -24,12 +108,12 @@ When a machine loses its connection to the internet but is still connected to a
 
 When a machine loses its connection to LAN or WAN, all client sessions will timeout and end by default.
 
-## Client session timeout and end
+### Client session timeout and end
 
 When your client cannot connect to your machine's `viam-server` instance, `viam-server` will end any current client [_sessions_](/dev/reference/apis/sessions/) on this machine and all client operations will [timeout automatically](/dev/reference/apis/sessions/) and halt: any active commands will be cancelled, stopping any moving parts, and no new commands will be able to reach the machine until the connection is restored.
 
 To disable the default behavior and manage resource timeout and reconfiguration over a networking session yourself, you can [disable the default behavior](/dev/reference/apis/sessions/#disable-default-session-management) of session management, then use [Viam's SDKs](/dev/reference/sdks/) in your code to make calls to [the session management API](https://pkg.go.dev/go.viam.com/rdk/session#hdr-API).
 
-## Configure a connection timeout
+### Configure a connection timeout
 
 When connecting to a machine using the [robot API](/dev/reference/apis/robot/) from a supported [Viam SDK](/dev/reference/apis/), you can configure an [optional timeout](/dev/reference/apis/robot/#configure-a-timeout) to account for intermittent or delayed network connectivity.


Reviews:
user: login: npentrel
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-11T11:29:22Z
user: login: npentrel
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-11T13:07:13Z
user: login: npentrel
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-11T13:28:28Z
user: login: JessamyT
body: LGTM
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-12T01:22:53Z
user: login: npentrel
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-12T11:04:51Z
user: login: npentrel
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-12T11:05:36Z

Review comments:
path: docs/dev/reference/sdks/_index.md
user: login: npentrel
body: unrelated change. ignore
created_at: 2025-03-11T11:29:22Z
author_association: CONTRIBUTOR
diff_hunk: @@ -15,6 +15,76 @@ date: "2022-01-01"
 
 When connecting to a machine using the connection code from the [**CONNECT** tab](/dev/reference/sdks/), a [client session](/dev/reference/apis/sessions/) automatically uses the most efficient route to connect to your machine either through local LAN or WAN or the internet.
 
+## Connect over local network
+
+To connect directly to the local machine, change the end of the machine address URI from `.viam.cloud` to `.local.viam.cloud` in your machine's connection code.
+The default machine address (URI) from the **CONNECT** tab is of the form `mymachine-main.0a1bcdefgi.viam.cloud`, so `mymachine-main.0a1bcdefgi.local.viam.cloud`.
+
+{{< tabs >}}
+{{% tab name="Python" %}}
+
+```python {class="line-numbers linkable-line-numbers" data-line="10"}
+async def connect():
+    opts = RobotClient.Options.with_api_key(
+         # Replace "<API-KEY>" (including brackets) with your machine's API key
+        api_key='<API-KEY>',
+        # Replace "<API-KEY-ID>" (including brackets) with your machine's
+        # API key id
+        api_key_id='<API-KEY-ID>'
+    )
+    return await RobotClient.at_address(
+        'mymachine-main.0a1bcdefgi.local.viam.cloud', opts)
+```
+
+{{% /tab %}}
+{{% tab name="Go" %}}
+
+```go {class="line-numbers linkable-line-numbers" data-line="3"}
+machine, err := client.New(
+  context.Background(),
+  "mymachine-main.0a1bcdefgi.local.viam.cloud",
+  logger,
+  client.WithDialOptions(rpc.WithEntityCredentials(
+          /* Replace "<API-KEY-ID>" (including brackets) with your machine's api key id */
+    "<API-KEY-ID>",
+    rpc.Credentials{
+      Type:    rpc.CredentialsTypeAPIKey,
+              /* Replace "<API-KEY>" (including brackets) with your machine's api key */
+      Payload: "<API-KEY>",
+    })),
+)
+```
+
+{{% /tab %}}
+{{% tab name="TypeScript" %}}
+The TypeScript SDK currently does not support mDNS which means you cannot use it to connect to your machine over a local network.
+{{% /tab %}}
+{{% tab name="Flutter %}}
path: docs/dev/reference/sdks/connectivity.md
user: login: npentrel
body: ```suggestion
{{% tab name="Flutter" %}}
```

created_at: 2025-03-11T13:07:09Z
author_association: CONTRIBUTOR
diff_hunk: @@ -15,6 +15,76 @@ date: "2022-01-01"
 
 When connecting to a machine using the connection code from the [**CONNECT** tab](/dev/reference/sdks/), a [client session](/dev/reference/apis/sessions/) automatically uses the most efficient route to connect to your machine either through local LAN or WAN or the internet.
 
+## Connect over local network
+
+To connect directly to the local machine, change the end of the machine address URI from `.viam.cloud` to `.local.viam.cloud` in your machine's connection code.
+The default machine address (URI) from the **CONNECT** tab is of the form `mymachine-main.0a1bcdefgi.viam.cloud`, so `mymachine-main.0a1bcdefgi.local.viam.cloud`.
+
+{{< tabs >}}
+{{% tab name="Python" %}}
+
+```python {class="line-numbers linkable-line-numbers" data-line="10"}
+async def connect():
+    opts = RobotClient.Options.with_api_key(
+         # Replace "<API-KEY>" (including brackets) with your machine's API key
+        api_key='<API-KEY>',
+        # Replace "<API-KEY-ID>" (including brackets) with your machine's
+        # API key id
+        api_key_id='<API-KEY-ID>'
+    )
path: docs/dev/reference/sdks/connectivity.md
user: login: npentrel
body: ```suggestion
    opts = RobotClient.Options.with_api_key(
        # Replace "<API-KEY>" (including brackets) with your machine's API key
        api_key='<API-KEY>',
        # Replace "<API-KEY-ID>" (including brackets) with your machine's
        # API key id
        api_key_id='<API-KEY-ID>'
    )
```
created_at: 2025-03-11T13:28:28Z
author_association: CONTRIBUTOR
diff_hunk: @@ -15,6 +15,76 @@ date: "2022-01-01"
 
 When connecting to a machine using the connection code from the [**CONNECT** tab](/dev/reference/sdks/), a [client session](/dev/reference/apis/sessions/) automatically uses the most efficient route to connect to your machine either through local LAN or WAN or the internet.
 
+## Connect over local network
+
+To connect directly to the local machine, change the end of the machine address URI from `.viam.cloud` to `.local.viam.cloud` in your machine's connection code.
+The default machine address (URI) from the **CONNECT** tab is of the form `mymachine-main.0a1bcdefgi.viam.cloud`, so `mymachine-main.0a1bcdefgi.local.viam.cloud`.
+
+{{< tabs >}}
+{{% tab name="Python" %}}
+
+```python {class="line-numbers linkable-line-numbers" data-line="10"}
+async def connect():
+    opts = RobotClient.Options.with_api_key(
+        # Replace "<API-KEY>" (including brackets) with your machine's API key
+        api_key='<API-KEY>',
+        # Replace "<API-KEY-ID>" (including brackets) with your machine's
+        # API key id
path: docs/dev/reference/sdks/connectivity.md
user: login: JessamyT
body: ```suggestion
        # API key ID
```
[nit/opt] Same for all api -> API as well but this is everywhere so can disregard
created_at: 2025-03-12T01:19:29Z
author_association: CONTRIBUTOR
diff_hunk: @@ -15,6 +15,76 @@ date: "2022-01-01"
 
 When connecting to a machine using the connection code from the [**CONNECT** tab](/dev/reference/sdks/), a [client session](/dev/reference/apis/sessions/) automatically uses the most efficient route to connect to your machine either through local LAN or WAN or the internet.
 
+## Connect over local network
+
+To connect directly to the local machine, change the end of the machine address URI from `.viam.cloud` to `.local.viam.cloud` in your machine's connection code.
+The default machine address (URI) from the **CONNECT** tab is of the form `mymachine-main.0a1bcdefgi.viam.cloud`, so `mymachine-main.0a1bcdefgi.local.viam.cloud`.
+
+{{< tabs >}}
+{{% tab name="Python" %}}
+
+```python {class="line-numbers linkable-line-numbers" data-line="10"}
+async def connect():
+    opts = RobotClient.Options.with_api_key(
+        # Replace "<API-KEY>" (including brackets) with your machine's API key
+        api_key='<API-KEY>',
+        # Replace "<API-KEY-ID>" (including brackets) with your machine's
+        # API key id
+        api_key_id='<API-KEY-ID>'
+    )
+    return await RobotClient.at_address(
+        'mymachine-main.0a1bcdefgi.local.viam.cloud', opts)
+```
+
+{{% /tab %}}
+{{% tab name="Go" %}}
+
+```go {class="line-numbers linkable-line-numbers" data-line="3"}
+machine, err := client.New(
+  context.Background(),
+  "mymachine-main.0a1bcdefgi.local.viam.cloud",
+  logger,
+  client.WithDialOptions(rpc.WithEntityCredentials(
+          /* Replace "<API-KEY-ID>" (including brackets) with your machine's api key id */
+    "<API-KEY-ID>",
+    rpc.Credentials{
+      Type:    rpc.CredentialsTypeAPIKey,
+              /* Replace "<API-KEY>" (including brackets) with your machine's api key */
+      Payload: "<API-KEY>",
+    })),
+)
+```
+
+{{% /tab %}}
+{{% tab name="TypeScript" %}}
+The TypeScript SDK currently does not support mDNS which means you cannot use it to connect to your machine over a local network.
+{{% /tab %}}
+{{% tab name="Flutter" %}}
+
+```dart {class="line-numbers linkable-line-numbers" data-line="2"}
+Future<void> connectToViam() async {
+  const host = 'mymachine-main.0a1bcdefgi.local.viam.cloud';
+  /* Replace "<API-KEY-ID>" (including brackets) with your machine's api key id */
+  const apiKeyID = '<API-KEY-ID>';
+  /* Replace "<API-KEY>" (including brackets) with your machine's api key */
+  const apiKey = '<API-KEY>';
+
+  final machine = await RobotClient.atAddress(
+    host,
+    RobotClientOptions.withApiKey(apiKeyID, apiKey),
+  );
+  print(machine.resourceNames);
+}
+```
+
+{{% /tab %}}
+{{% tab name="C++" %}}
+The C++ SDK currently does not support mDNS which means you cannot use it to connect to your machine over a local network.
path: docs/dev/reference/sdks/connectivity.md
user: login: JessamyT
body: ```suggestion
The C++ SDK currently does not support mDNS, which means you cannot use it to connect to your machine over a local network.
```
[opt] This is how I read it in my head
created_at: 2025-03-12T01:20:16Z
author_association: CONTRIBUTOR
diff_hunk: @@ -15,6 +15,76 @@ date: "2022-01-01"
 
 When connecting to a machine using the connection code from the [**CONNECT** tab](/dev/reference/sdks/), a [client session](/dev/reference/apis/sessions/) automatically uses the most efficient route to connect to your machine either through local LAN or WAN or the internet.
 
+## Connect over local network
+
+To connect directly to the local machine, change the end of the machine address URI from `.viam.cloud` to `.local.viam.cloud` in your machine's connection code.
+The default machine address (URI) from the **CONNECT** tab is of the form `mymachine-main.0a1bcdefgi.viam.cloud`, so `mymachine-main.0a1bcdefgi.local.viam.cloud`.
+
+{{< tabs >}}
+{{% tab name="Python" %}}
+
+```python {class="line-numbers linkable-line-numbers" data-line="10"}
+async def connect():
+    opts = RobotClient.Options.with_api_key(
+        # Replace "<API-KEY>" (including brackets) with your machine's API key
+        api_key='<API-KEY>',
+        # Replace "<API-KEY-ID>" (including brackets) with your machine's
+        # API key id
+        api_key_id='<API-KEY-ID>'
+    )
+    return await RobotClient.at_address(
+        'mymachine-main.0a1bcdefgi.local.viam.cloud', opts)
+```
+
+{{% /tab %}}
+{{% tab name="Go" %}}
+
+```go {class="line-numbers linkable-line-numbers" data-line="3"}
+machine, err := client.New(
+  context.Background(),
+  "mymachine-main.0a1bcdefgi.local.viam.cloud",
+  logger,
+  client.WithDialOptions(rpc.WithEntityCredentials(
+          /* Replace "<API-KEY-ID>" (including brackets) with your machine's api key id */
+    "<API-KEY-ID>",
+    rpc.Credentials{
+      Type:    rpc.CredentialsTypeAPIKey,
+              /* Replace "<API-KEY>" (including brackets) with your machine's api key */
+      Payload: "<API-KEY>",
+    })),
+)
+```
+
+{{% /tab %}}
+{{% tab name="TypeScript" %}}
+The TypeScript SDK currently does not support mDNS which means you cannot use it to connect to your machine over a local network.
path: docs/dev/reference/sdks/connectivity.md
user: login: JessamyT
body: ```suggestion
The TypeScript SDK currently does not support mDNS, which means you cannot use it to connect to your machine over a local network.
```
[opt]
created_at: 2025-03-12T01:21:06Z
author_association: CONTRIBUTOR
diff_hunk: @@ -15,6 +15,76 @@ date: "2022-01-01"
 
 When connecting to a machine using the connection code from the [**CONNECT** tab](/dev/reference/sdks/), a [client session](/dev/reference/apis/sessions/) automatically uses the most efficient route to connect to your machine either through local LAN or WAN or the internet.
 
+## Connect over local network
+
+To connect directly to the local machine, change the end of the machine address URI from `.viam.cloud` to `.local.viam.cloud` in your machine's connection code.
+The default machine address (URI) from the **CONNECT** tab is of the form `mymachine-main.0a1bcdefgi.viam.cloud`, so `mymachine-main.0a1bcdefgi.local.viam.cloud`.
+
+{{< tabs >}}
+{{% tab name="Python" %}}
+
+```python {class="line-numbers linkable-line-numbers" data-line="10"}
+async def connect():
+    opts = RobotClient.Options.with_api_key(
+        # Replace "<API-KEY>" (including brackets) with your machine's API key
+        api_key='<API-KEY>',
+        # Replace "<API-KEY-ID>" (including brackets) with your machine's
+        # API key id
+        api_key_id='<API-KEY-ID>'
+    )
+    return await RobotClient.at_address(
+        'mymachine-main.0a1bcdefgi.local.viam.cloud', opts)
+```
+
+{{% /tab %}}
+{{% tab name="Go" %}}
+
+```go {class="line-numbers linkable-line-numbers" data-line="3"}
+machine, err := client.New(
+  context.Background(),
+  "mymachine-main.0a1bcdefgi.local.viam.cloud",
+  logger,
+  client.WithDialOptions(rpc.WithEntityCredentials(
+          /* Replace "<API-KEY-ID>" (including brackets) with your machine's api key id */
+    "<API-KEY-ID>",
+    rpc.Credentials{
+      Type:    rpc.CredentialsTypeAPIKey,
+              /* Replace "<API-KEY>" (including brackets) with your machine's api key */
path: docs/dev/reference/sdks/connectivity.md
user: login: npentrel
body: ```suggestion
          /* Replace "<API-KEY-ID>" (including brackets) with your machine's API key ID */
    "<API-KEY-ID>",
    rpc.Credentials{
      Type:    rpc.CredentialsTypeAPIKey,
              /* Replace "<API-KEY>" (including brackets) with your machine's API key */
```
created_at: 2025-03-12T11:04:50Z
author_association: CONTRIBUTOR
diff_hunk: @@ -15,6 +15,76 @@ date: "2022-01-01"
 
 When connecting to a machine using the connection code from the [**CONNECT** tab](/dev/reference/sdks/), a [client session](/dev/reference/apis/sessions/) automatically uses the most efficient route to connect to your machine either through local LAN or WAN or the internet.
 
+## Connect over local network
+
+To connect directly to the local machine, change the end of the machine address URI from `.viam.cloud` to `.local.viam.cloud` in your machine's connection code.
+The default machine address (URI) from the **CONNECT** tab is of the form `mymachine-main.0a1bcdefgi.viam.cloud`, so `mymachine-main.0a1bcdefgi.local.viam.cloud`.
+
+{{< tabs >}}
+{{% tab name="Python" %}}
+
+```python {class="line-numbers linkable-line-numbers" data-line="10"}
+async def connect():
+    opts = RobotClient.Options.with_api_key(
+        # Replace "<API-KEY>" (including brackets) with your machine's API key
+        api_key='<API-KEY>',
+        # Replace "<API-KEY-ID>" (including brackets) with your machine's
+        # API key id
+        api_key_id='<API-KEY-ID>'
+    )
+    return await RobotClient.at_address(
+        'mymachine-main.0a1bcdefgi.local.viam.cloud', opts)
+```
+
+{{% /tab %}}
+{{% tab name="Go" %}}
+
+```go {class="line-numbers linkable-line-numbers" data-line="3"}
+machine, err := client.New(
+  context.Background(),
+  "mymachine-main.0a1bcdefgi.local.viam.cloud",
+  logger,
+  client.WithDialOptions(rpc.WithEntityCredentials(
+          /* Replace "<API-KEY-ID>" (including brackets) with your machine's api key id */
+    "<API-KEY-ID>",
+    rpc.Credentials{
+      Type:    rpc.CredentialsTypeAPIKey,
+              /* Replace "<API-KEY>" (including brackets) with your machine's api key */
+      Payload: "<API-KEY>",
+    })),
+)
+```
+
+{{% /tab %}}
+{{% tab name="TypeScript" %}}
+The TypeScript SDK currently does not support mDNS which means you cannot use it to connect to your machine over a local network.
+{{% /tab %}}
+{{% tab name="Flutter" %}}
+
+```dart {class="line-numbers linkable-line-numbers" data-line="2"}
+Future<void> connectToViam() async {
+  const host = 'mymachine-main.0a1bcdefgi.local.viam.cloud';
+  /* Replace "<API-KEY-ID>" (including brackets) with your machine's api key id */
+  const apiKeyID = '<API-KEY-ID>';
+  /* Replace "<API-KEY>" (including brackets) with your machine's api key */
+  const apiKey = '<API-KEY>';
path: docs/dev/reference/sdks/connectivity.md
user: login: npentrel
body: ```suggestion
  /* Replace "<API-KEY-ID>" (including brackets) with your machine's API key ID */
  const apiKeyID = '<API-KEY-ID>';
  /* Replace "<API-KEY>" (including brackets) with your machine's API key */
  const apiKey = '<API-KEY>';
```
created_at: 2025-03-12T11:05:36Z
author_association: CONTRIBUTOR

PR comments:
user: login: netlify[bot]
created_at: 2025-03-11T11:29:29Z
body: ### <span aria-hidden="true">✅</span> Deploy Preview for *viam-docs* ready!


|  Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 809b58b77a730b27e7a5cc598cba2e588125ea8e |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/sites/viam-docs/deploys/67d16ba23fefac00081d9cda |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-4066--viam-docs.netlify.app](https://deploy-preview-4066--viam-docs.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTQwNjYtLXZpYW0tZG9jcy5uZXRsaWZ5LmFwcCJ9.q9b5DVJkq6PvPfRqPHlUX_jaoL8H5Jg9py3XPgQtaO4)<br /><br />_Use your smartphone camera to open QR code link._</details> |
|<span aria-hidden="true">![Lighthouse](https://app.netlify.com/public/external-usage/git-comments/lighthouse-sm.png)</span><br />Lighthouse | 1 paths audited<br />**Performance**: 24 (🔴 down 7 from production)<br />**Accessibility**: 100 (no change from production)<br />**Best Practices**: 100 (no change from production)<br />**SEO**: 92 (no change from production)<br />**PWA**: 70 (no change from production)<br />[View the detailed breakdown and full score reports](https://app.netlify.com/sites/viam-docs/deploys/67d16ba23fefac00081d9cda) |
---
<!-- [viam-docs Preview](https://deploy-preview-4066--viam-docs.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify site configuration](https://app.netlify.com/sites/viam-docs/configuration/notifications#deploy-webhooks)._
author_association: NONE
user: login: njooma
created_at: 2025-03-11T16:50:44Z
body: Calling @stuqdog  -- C++ uses our rust-utils package, which should have mdns enabled
author_association: MEMBER
user: login: stuqdog
created_at: 2025-03-11T17:42:04Z
body: > According to the wiki C++ should support mDNS, however I was not able to connect over a local network with C++. Is the wiki wrong or am I missing something for C++? Thanks!

@npentrel what @njooma said is correct, C++ does have mDNS support through `rust-utils` and should be able to do local connection. Can you share a bit more details about what you tried, maybe code samples or something?

edit: ahh okay, I see the instruction about changing from `.viam.cloud` to `.local.viam.cloud`. I think this actually isn't the right advice when working with `rust-utils`. You should still be able to connect directly to a local connection without the `.local` addition, I suspect if you remove `.local` you will see a local connection done successfully. You can confirm that this was in fact a local connection by starting up viam server, then turning off your internet, then attempting to connect from C++ and seeing that it still does so successfully.

edit2: okay, the `.local` thing is a red herring. When I test locally I am able to make a local connection in C++ with wifi turned off with or without `.local`. in the URI. So there's something else going on in your case. Any info you can share would be appreciated!
author_association: MEMBER
user: login: npentrel
created_at: 2025-03-11T22:17:34Z
body: Ok if you've tested I'll trust you on it. I would hazard a guess that me running it in docker may be messing with it but I only just got c++ to compile again there and don't want to try to redo it on mac now. I'll readd the code snippet for c++ tomorrow 
author_association: CONTRIBUTOR
user: login: github-actions[bot]
created_at: 2025-03-12T11:14:32Z
body: :mag_right::speech_balloon: [Inkeep](https://inkeep.com) AI search and chat service is syncing content for source 'Viam Docs (https://docs.viam.com)'
author_association: NONE