Skip to content

Latest commit

 

History

History
81 lines (52 loc) · 4.27 KB

File metadata and controls

81 lines (52 loc) · 4.27 KB
description The client provides methods to configure the embedded device, manage sessions and listen to device related events.

Client

Methods

on(event, listener)

Listens for an event of the given name

client.on(event, data => {
   console.log(data)
})
EventData TypeDescription

app

AppetizeAppThe currently loaded Appetize app.

deviceInfo

DeviceInfoInformation about the current device, such as type, osVersion, and screen dimensions.

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

voidThe active queue has ended.

session

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

sessionEnded

voidThe active session has ended.

sessionError

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

sessionRequested

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

{% hint style="info" %} See Handle session startup failures for custom error UI and retry patterns. {% endhint %}

startSession()

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

const session = await client.startSession()

Parameters

Name Type Description
config? SessionConfig 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.

await client.setConfig(config)

Parameters

Name Type Description
config SessionConfig A JSON object describing the Configuration options for the device.

getConfig()

Returns the current config

const config = client.getConfig()

endSession()

Ends the active session or cancels any pending session requests.

await client.endSession()

Properties

device

The currently loaded device. See DeviceInfo.

app

The currently loaded app. See AppetizeApp.