For the complete documentation index, see llms.txt. This page is also available as Markdown.

Client

The client provides methods to configure the embedded device, manage sessions and listen to device related events.

Methods

on(event, listener)

Listens for an event of the given name

client.on(event, data => {
   console.log(data)
})
Event
Data Type
Description

app

Emitted when the loaded Appetize app changes. Read the initial app from client.app.

deviceInfo

Emitted when the current device changes. Read the initial device from client.device.

error

{ message: string }

An error has occurred. Use this event to display or record client errors.

queue

{ type: "session | concurrent", position: number, name: string }

Your position in queue for the device.

  • concurrent: You've reached the max concurrent sessions for your account and are waiting for the next available slot. The concurrent queue name will be shown.

  • session: You're in a queue, waiting for the next available device.

queueEnd

void

The active queue has ended.

session

Session

A new session has started either by the client or user clicking "Tap to Play"

sessionEnded

void

The active session has ended.

sessionError

Error

A session was served but failed to reach a ready state.

sessionRequested

void

A new session has been requested either by the client or user clicking "Tap to Play"

See Handle session startup failures for custom error UI and retry patterns.

startSession()

Starts a session with the requested app, device, operating system, and other launch options.

Parameters

Name
Type
Description

config?

A JSON object describing the Configuration options for the device.

setConfig()

Update the configured app, device, operating system, or other launch options.

Note: This will end any active sessions.

Parameters

Name
Type
Description

config

A JSON object describing the Configuration options for the device.

getConfig()

Returns the current config

endSession()

Ends the active session or cancels any pending session requests.

Properties

device

The initially loaded device. It updates when the device changes. See DeviceInfo.

app

The initially loaded app. It updates when the app changes. See AppetizeApp.

Last updated