Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update connectivity page
Browse files Browse the repository at this point in the history
npentrel committed Sep 23, 2023
1 parent b4113b5 commit a08d00c
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 2 additions & 0 deletions docs/program/apis/sessions.md
Original file line number Diff line number Diff line change
@@ -28,6 +28,8 @@ This is especially important for robots that physically move.
For example, imagine a wheeled rover gets a [`SetPower()`](/components/base/#setpower) command as the last input from a client before the connection to the robot is interrupted.
Without session management, the API request from the client would cause the rover's motors to move, causing the robot to continue driving forever and potentially colliding with objects and people.

For more information, see [Client Sessions and Robot Network Connectivity](/program/connectivity/).

If you want to manage operations differently, you can manage your robot's client sessions yourself.
The Session Management API provides functionality for:

23 changes: 10 additions & 13 deletions docs/program/connectivity.md
Original file line number Diff line number Diff line change
@@ -3,26 +3,23 @@ title: "Client Sessions and Robot Network Connectivity"
linkTitle: "Network Connectivity Issues"
weight: 20
type: "docs"
description: "Whan a robot loses its connection to the internet, all client sessions will timeout and end by default."
description: "When a robot loses its connection to a LAN or WAN, all client sessions will timeout and end by default."
tags:
["client", "sdk", "viam-server", "networking", "apis", "robot api", "session"]
---

What happens when your robot loses its connection to the internet over a LAN or WAN and can no longer communicate with clients through [the Viam app](https://app.viam.com).
A [client session](/program/apis/sessions/) uses the most efficient route to connect to your robot either through local LAN or WAN or the internet.

## How does `viam-server` work if your robot loses its network connection?
When a robot loses its connection to the internet but is still connected to a LAN or WAN:

When a robot loses its connection over LAN or WAN, it can no longer communicate with clients through [the Viam app](https://app.viam.com).
When no heartbeat has been received over a timeout period, `viam-server` will end any current client [_sessions_](/program/apis/sessions/) on this robot.
- Client sessions connected through the internet will timeout and end.
- Client sessions connected through the same LAN or WAN will function normally.
- [Cloud Sync](/services/data/#cloud-sync) for Data Management will pause until the internet connection is re-established since the robot will be unable to connect to the [Viam app](https://app.viam.com).

## What happens to clients connected to the robot when your robot loses its network connection?
When a robot loses its connection to LAN or WAN, all client sessions will timeout and end by default.

When your client cannot connect to your robot's `viam-server` instance, all client operations will timeout automatically and halt.
Any active commands will be cancelled, stopping any moving parts, and no new commands will be able to reach the robot until the connection is restored.
## Client session timeout and end

### How do Viam's client SDKs work if your robot loses its network connection?
When your client cannot connect to your robot's `viam-server` instance, `viam-server` will end any current client [_sessions_](/program/apis/sessions/) on this robot and all client operations will [timeout automatically](/program/apis/sessions/#heartbeats) and halt: any active commands will be cancelled, stopping any moving parts, and no new commands will be able to reach the robot until the connection is restored.

As a client of your robot, Viam's SDKs will by default have their session ended when the robot loses its connection to the internet.

To disable the default behavior here and manage resource timeout and reconfiguration over a networking session yourself, follow [these instructions](/program/apis/sessions/).
[Disable the default behavior](/program/apis/sessions/#disable-default-session-management) of session management, then utilize [Viam's SDKs](/program/) in your code to make calls to [the session management API](https://pkg.go.dev/go.viam.com/rdk/session#hdr-API).
To disable the default behavior and manage resource timeout and reconfiguration over a networking session yourself, you can [disable the default behavior](/program/apis/sessions/#disable-default-session-management) of session management, then use [Viam's SDKs](/program/) in your code to make calls to [the session management API](https://pkg.go.dev/go.viam.com/rdk/session#hdr-API).
4 changes: 2 additions & 2 deletions docs/program/run.md
Original file line number Diff line number Diff line change
@@ -12,11 +12,11 @@ After saving your [code sample](/program/#hello-world-the-code-sample-tab) and a

### Authentication

You must reference a robot's location secret to authenticate yourself to the robot.
You must authenticate yourself to the robot using the robot's location secret.
However, the app hides the robot location secret from the sample by default for your security.

To copy the robot location secret, select **Include Secret** on the **Code sample** tab of your robot's page on the [Viam app](https://app.viam.com).
Paste it into your SDK code as directed by the code sample.
Paste it into your environment variables or directly into your code.

You must also include the robot's remote address, like `12345.somerobot-main.viam.cloud`, as an external or public address to connect to your robot.
The code sample includes this address at default.

0 comments on commit a08d00c

Please sign in to comment.