Event Notifications
iClick actively pushes various event notifications through WebSocket, allowing your application to respond to device status changes, USB connection status, and other events in real-time.
Event Format
Event format pushed by the server:
json
{
"type": "event",
"event": "event_name",
"data": { /* event data */ }
}Field Description:
type(string): Fixed as"event", indicating this is an event pushevent(string): Event name, used to distinguish different types of eventsdata(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:
json
{
"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
}
}