Skip to main content
The ClientWorker class represents a worker (the Uplink SDK running on a physical device) connected to your Uplink session. It provides methods for managing browsers on the worker and querying device information.
A worker is an instance of the Uplink SDK running on a physical iOS or Android device. A device can create multiple workers when connecting to sessions.

Browser operations

worker.launch()

Launches a new browser on this worker. Used when listening for worker-connected events from the Client class.
worker.launch(): Promise<Browser>
Returns: Promise<Browser> - New browser instance Example:
client.on('worker-connected', async (worker) => {
  const browser = await worker.launch()
  const page = await browser.newPage()
  await page.goto('https://example.com')
  await page.close()
  await browser.close()
  await client.close()
})

worker.browsers()

Lists all browsers currently running on this worker.
worker.browsers(): Promise<Browser[]>
Returns: Promise<Browser[]> - Array of browser instances Example:
const browsers = await worker.browsers()

console.log(`${browsers.length} browsers on this worker`)

for (const browser of browsers) {
  const pages = await browser.pages()
  console.log(`Browser ${browser.handle} has ${pages.length} pages`)
}

Device information

worker.getDeviceInfo()

Gets device information including model, platform, and OS version.
worker.getDeviceInfo(): Promise<WorkerInfo>
Returns: Promise<WorkerInfo> - Device information object Example:
const info = await worker.getDeviceInfo()

console.log('Device model:', info.deviceModel)      // "iPhone 14 Pro"
console.log('Platform:', info.platform)             // "iOS"
console.log('OS version:', info.platformVersion)    // "17.2"
console.log('Type:', info.deviceType)              // "phone"

WorkerInfo type

interface WorkerInfo {
  deviceModel: string      // Device model name
  platform: string         // "iOS" or "Android"
  platformVersion: string  // OS version number
  deviceType: string       // "phone" or "tablet"
}

Worker management

worker.terminate()

Terminates this worker’s connection to the session.
worker.terminate(): Promise<void>
Returns: Promise<void> Example:
await worker.terminate()
console.log('Worker terminated')
Terminating a worker closes all browsers running on it and disconnects the device from the session. This action cannot be undone.

Properties

worker.address

The unique hex-encoded address identifier for this worker.
worker.address: Address  // Hex-encoded worker address