> ## Documentation Index
> Fetch the complete documentation index at: https://docs.phones.farm/llms.txt
> Use this file to discover all available pages before exploring further.

# Event Notifications

> WebSocket and webhook event subscription specs for device attach, detach, error, and script status alerts.

### Event Format

Event format pushed by the server:

```
{
  "type": "event",
  "event": "event_name",
  "data": { /* event data */ }
}
```

**Field Description:**

* `type` (string): Fixed as `"event"`, indicating this is an event push
* `event` (string): Event name, used to distinguish different types of events
* `data` (object): Data carried by the event, varies by event type

### Event List

#### Device Events

| Event Name | Description | Trigger Timing |
| - | - | - |
| `device:online` | Device online | Triggered when iOS device connects to iClick |
| `device:offline` | Device offline | Triggered when iOS device disconnects |
| `device:reject` | Device connection rejected | Triggered when device cannot connect due to permission issues |
| `device:delete` | Device deleted | Triggered when device is removed from the device list |
| `device:busy` | Device busy | Triggered when device starts executing a task |
| `device:idle` | Device idle | Triggered when device completes a task and becomes idle |
| `device:rename` | Device renamed | Triggered when device name is modified |
| `device:bindchip` | Device bind chip | Triggered when device is bound to a USB chip board |

#### USB Events

| Event Name | Description | Trigger Timing |
| - | - | - |
| `usb:plug` | USB plugged in | Triggered when USB chip board connects |
| `usb:unplug` | USB unplugged | Triggered when USB chip board disconnects |

### Event Examples

#### device:online

Device online event, triggered when iOS device successfully connects to iClick.

**Event Data:**

```
{
  "type": "event",
  "event": "device:online",
  "data": {
    "info": {
      "deviceName": "My iPhone",
      "deviceIdentifier": "iPhone15,2",
      "deviceChip": "XXXXXXXX",
      "screenWidth": 1179,
      "screenHeight": 2556,
      "orientation": 1,
      "screenScale": 3.0,
      "deviceVersion": "17.0",
      "deviceRounded": true
    },
    "plugged": true,
    "time": 1697472000,
    "online": true
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.