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 project API key and enable secure, real-time bidirectional communication.Creating sessions
Sessions are created programmatically in your code using your project API key and project ID.Get your credentials
In Uplink Console, navigate to Settings → API Keys to find your project API key and project ID. Keep these credentials secure.
API keys and session security
Sessions are authenticated using your project API key, which provides:- Project identity: Links sessions to your Uplink project
- Project scope: Sessions are associated with a specific project ID
- Secure communication: Encrypted connections between your code and devices
- Access control: Manage permissions through Console settings
Token security best practices
Keep API keys secret
Keep API keys secret
Treat API keys like passwords. Never commit them to source control or expose them in client-side code.
Manage session lifecycle
Manage session lifecycle
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.
Use project-specific keys
Use project-specific keys
Use different project IDs to isolate different environments or use cases. This helps organize your automations and manage access control.
Rotate API keys regularly
Rotate API keys regularly
Regularly rotate API keys, especially after team member changes or security incidents. You can manage keys in the Uplink Console.
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:Session expiration
Sessions end when:- The connection is closed by the client (
client.close()) - The session is terminated in the Console
- The API key used to create the session is revoked
- Network connectivity is lost
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