Sessions are the foundation of Uplink’s security and connection model. Understanding how to create, manage, and secure sessions is essential for production use.
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.
The session object exposes two URLs for connecting a device. Use the one that matches your integration:
Connect app
Native SDK
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.
import QRCode from 'qrcode'const qrCodeImage = await QRCode.toDataURL(session.qrUrl)// Render qrCodeImage in your UI
Deliver session.sessionUrl to your app through your own channel (push notification, deep link, API response, etc.), then pass it to the native SDK’s worker.connect method.
const sessionUrl = session.sessionUrl// Deliver sessionUrl to your iOS or Android app
See the iOS SDK and Android SDK guides for how the app side consumes the URL.
When you connect to a session, the client establishes a WebSocket connection to the Uplink relay server:
const session = await uplink.session('<project-api-key>', { projectId: '<project-id>', include: { ecdsa: true, ecdh: true }})const client = await uplink.client.fromSession(session)console.log('Connected to session')// The client is now ready to interact with devices
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
When a session expires, all connected devices are disconnected and browsers are closed. Plan for graceful handling of session expiration in long-running automations.