| description | The client provides methods to configure the embedded device, manage sessions and listen to device related events. |
|---|
Listens for an event of the given name
client.on(event, data => {
console.log(data)
})| Event | Data Type | Description |
|---|---|---|
| AppetizeApp | 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. | |
{ message: string } | An error has occurred. Use this event to display or record client errors. | |
{type: "session | concurrent",position: number,name: string} | Your position in queue for the device.
| |
void | The active queue has ended. | |
Session | A new session has started either by the client or user clicking "Tap to Play" | |
void | The active session has ended. | |
Error | A session was served but failed to reach a ready state. | |
void | A 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 %}
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. |
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. |
Returns the current config
const config = client.getConfig()Ends the active session or cancels any pending session requests.
await client.endSession()The initially loaded device. It updates when the device changes. See DeviceInfo.
The initially loaded app. It updates when the app changes. See AppetizeApp.