提交工单
咨询集成、功能及报价等问题
You can use this callback to listen for user login and logout and implement the business logic, for example, counting online users.
Request method: POST/JSON.
<div class="mk-hint">
The callback data needs to be decoded by UrlDecode.
Request URL: Contact ZEGOCLOUD technical support to configure the callback URL.
Protocol: HTTPS/HTTP. HTTPS is recommended.
Parameter | Type | Description |
---|---|---|
appid |
String |
The unique ID of an app. |
event |
String |
The callback event. The return value is user_action . |
timestamp |
Integer |
The Unix timestamp of the callback server. Unit: seconds. |
nonce |
String |
A random number. |
signature |
String |
The verification string. For more information, see Authenticating server-to-server callbacks. |
user_id |
String |
The user ID. |
user_name |
STRING |
The username. |
os |
String |
The description of the operating system, which is synchronized upon user login. Valid values:
|
action |
Integer |
Status. Valid values:
|
session_id |
String |
The unique ID of a session. If a user is online on multiple terminals, multiple sessions exist and are identified by ID. |
login_time |
Integer |
The Unix timestamp of login. Unit: seconds. |
relogin |
String |
The identifier of re-login. Valid values:
|
logout_time |
Integer |
The Unix timestamp of logout. Unit: seconds. |
logout_reason |
String |
The reason for logout. |
offline_time |
Integer |
The Unix timestamp of going offline. Unit: seconds. |
{
"appid": "1",
"event": "user_action",
"timestamp": 1679553625,
"nonce": "350176",
"signature": "signature",
"user_id": "123456",
"user_name": "user_name",
"os": "PC ",
"action": 1,
"session_id": "930821637828251648",
"login_time": 1679553625,
"relogin": "1",
"logout_time": 1679553625,
"logout_reason": "logout_reason"
}
If an HTTP status code 2XX (for example, 200) is returned, the callback succeeded. Otherwise, the callback failed.
If the ZEGOCLOUD server does not receive a response, it will retry with intervals of 2s, 4s, 8s, 16s, and 32s respectively. If the retry still fails after an interval of 32s, it will no longer retry.