Previous
Extra params
When connecting to a machine using the connection code from the CONNECT tab, a client session automatically uses the most efficient route to connect to your machine either through local LAN or WAN or the internet.
To connect directly to your local machine, you can use the connection code from the CONNECT tab if you are using the Python SDK, Go SDK, Flutter SDK, or C++ SDK.
For the TypeScript SDK, you must disable TLS verification for your viam-server
and change the sinaling address for the connection code:
Restart viam-server
with the -no-tls
flag.
Add "no_tls": true
to the "network"
section of your machine’s JSON configuration:
"network": {
"no_tls": true
}
Restart your machine. You can restart your machine by clicking on the machine status indicator in Viam and clicking Restart.
Update the signaling address in your connection code:
const host = "mymachine-main.0a1bcdefgi.viam.cloud";
const machine = await VIAM.createRobotClient({
host,
credentials: {
type: "api-key",
/* Replace "<API-KEY>" (including brackets) with your machine's API key */ payload:
"<API-KEY>",
authEntity: "<API-KEY-ID>",
/* Replace "<API-KEY-ID>" (including brackets) with your machine's API key ID */
},
signalingAddress: `http://${host}.local:8080`,
});
When a machine loses its connection to the internet but is still connected to a LAN or WAN:
When a machine loses its connection to LAN or WAN, all client sessions will timeout and end by default.
When your client cannot connect to your machine’s viam-server
instance, viam-server
will end any current client sessions on this machine and all client operations will time out automatically 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 of session management, then use Viam’s SDKs in your code to make calls to the session management API.
There are a couple of exceptions to the general timeout behavior:
MoveOnMap
or MoveOnGlobe
command has completed a motion plan and returned an execution ID before the connection is lost, the resource that receives the motion plan will complete the motion without a connection.When connecting to a machine using the robot API from a supported Viam SDK, you can configure an optional timeout to account for intermittent or delayed network connectivity.
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!