Skip to main content
Sessions are the foundation of Uplink’s security and connection model. Understanding how to create, manage, and secure sessions is essential for production use.

What is a session?

A session is an authenticated connection that allows your JavaScript code to communicate with mobile devices. Sessions are created programmatically using your OAuth client credentials and enable secure, real-time bidirectional communication.

Creating sessions

Sessions are created programmatically in your code using your OAuth client credentials. The session is automatically scoped to the project the client belongs to.
1

Get your credentials

Create an OAuth client in Uplink Console and copy its client ID and secret. See Authentication for the full walkthrough.
2

Create a session in code

Use the uplink.session() method to create a session with your credentials:
3

Connect a client to the session

Create a client from your session to interact with connected devices:
4

Deliver the session to your device

The session object exposes two URLs for connecting a device. Use the one that matches your integration:
Display session.qrUrl as a QR code in your UI. When your user scans it, the Uplink Connect app opens and joins the session automatically.

Session security

Sessions are authenticated with your OAuth client credentials, which provide:
  • Project identity: Each OAuth client belongs to exactly one project — sessions created with it are scoped to that project automatically.
  • Secure communication: Encrypted connections between your code and devices
  • Access control: Manage permissions through Console settings
For how to create credentials and keep them safe, see Authentication.

Session lifecycle

Connection

When you connect to a session, the client establishes a WebSocket connection to the Uplink relay server:

Active session

During an active session:
  • Devices can connect and disconnect
  • Browsers can be launched and managed
  • Commands are sent in real-time
  • Events are emitted for device state changes

Closing a session

Always close the client when you’re done to properly clean up resources:
Create and destroy sessions as needed for your use case. For automated testing, create a new session for each test run and close it when complete.

Session expiration

Sessions end when:
  • The connection is closed by the client (client.close())
  • The session is terminated in the Console
  • The OAuth client used to create the session is disabled or deleted
  • Network connectivity is lost
When a session expires, all connected devices are disconnected and browsers are closed. Plan for graceful handling of session expiration in long-running automations.

Multi-session patterns

Load distribution

For high-volume automation, distribute load across multiple sessions:

Next steps

Device management

Learn how to manage devices in sessions

Client API

Explore the Client API reference