Request
Webhook authentication: Add authentication headers to the request. See Authentication.
Delivery result: To acknowledge successful delivery, your application server must respond with HTTP status code 200.
Delivery mechanism: Message delivery is attempted up to three times at 100 ms intervals. If all three attempts fail, the delivery is considered unsuccessful. Delivery uses Google's adaptive circuit breaker. If too many requests fail within a sliding time window, the circuit breaker is triggered and delivery to your application server is temporarily suspended.
Parameters
| Parameter | Data Type | Required | Description |
|---|---|---|---|
| event_type | string | Yes | Event type. For online and offline status subscriptions, this value is online. |
| timestamp | int64 | Yes | Event timestamp in milliseconds. |
| payload | array | Yes | List of online and offline status events. |
| payload[].type | int | Yes | Online status. 1: online; 0: offline. |
| payload[].user_id | string | Yes | User ID. |
| payload[].device_id | string | Yes | Device ID. |
| payload[].platform | string | Yes | Valid values: iOS, Android, iPad, and web. |
| payload[].client_ip | string | Yes | Client IP address. |
| payload[].session_id | string | Yes | Unique identifier for the current persistent connection. |
| payload[].timestamp | int64 | Yes | Online or offline event timestamp in milliseconds. |
| payload[].connection_ext | string | Yes | Custom data included when the connection was established. |
| payload[].instance_id | string | No | Instance identifier used when multiple Web or PC instances are open. Mobile clients do not support multiple instances, so this field is empty for mobile connections. |
Request Example
POST /onlinestatus/notification HTTP/1.1;
appkey: appkey;
signature: 2e639ae3600a4sdff61fb88b76f485b;
nonce: nonce;
timestamp: 1672568121910;
Content-Type: application/json;
{
"event_type": "online", //event type: message or online
"timestamp": 1713456000000, //timestamp in milliseconds
"payload": [
{
"type": 0, //1online; 0: offline
"user_id": "userid1", //user UID
"device_id": "1fsdf1", // device identifier
"platform": "web", //iOS,Android,iPad,web
"client_ip": "192.116.1.1",
"session_id": "123",//unique identifier for this persistent connection
"timestamp": 1713456000000,
"connection_ext":"ext",//custom extension supplied when connecting
"instance_id":"instance_id" //identifies an instance when multiple Web/PC instances are open. Mobile clients do not support multiple instances, so this field is empty
}
]
}