User Offline Status Callback
Function Description
The App business server can use this callback to change the user's status to offline.
Notes
- To enable the callback, it is necessary to configure the callback URL and activate the switch corresponding to this callback protocol. For configuration methods, see the Callback Description document.
- The direction of the callback is an HTTP/HTTPS POST request initiated by OpenIM Server to the App backend.
- After receiving the callback request, the App business server needs to verify whether the command parameter in the request URL is their own SDKNAME parameter.
- The APP business server must respond to this request within the timeout period.
Scenarios That May Trigger This Callback
- When a user initiates a logout request to go offline through the client.
- When the user's client experiences a disconnection.
- When a user actively kills the client process, or if the process is killed by the mobile operating system when the app is in the background, or if the process exits abnormally due to a crash.
- Client heartbeat timeout, such as when the network is turned off, or completely unavailable.
Timing of Callback
- When a user goes offline, either actively or passively.
Interface Description
Request URL Example
In the following example, the callback URL configured by the App is https://callbackurl
.
https://callbackurl?command=$CallbackCommand&contenttype=json
Request Parameter Description
Parameter | Description |
---|---|
https | The request protocol is HTTPS, and the method is POST. |
https://callbackurl | Callback URL |
CallbackCommand | Fixed value: callbackUserOfflineCommand |
contenttype | Fixed value: JSON |
Header
Header Name | Example Value | Optional | Type | Description |
---|---|---|---|---|
operationID | 1646445464564 | Required | string | operationID for global link tracing |
Request Package Example
{
"userID": "user123",
"callbackCommand": "callbackUserOfflineCommand",
"seq": 123456,
"connID": "conn123"
}
Request Package Field Description
Field | Type | Description |
---|---|---|
userID | string | Unique identifier of the user. |
callbackCommand | string | Callback command, here for user offline status callback. |
seq | int64 | Request sequence number. |
connID | string | Connection identifier of the user. |
Response Package Example
Processing Result
User is offline.
{
"actionCode": 0,
"errCode": 0,
"errMsg": "",
"errDlt": "",
"nextCode": ""
}
Response Package Field Description
Field | Value | Description |
---|---|---|
actionCode | 0 | Indicates whether the business system's callback was executed correctly. 0 means the operation was successful. |
errCode | 0 | Custom error code, here 0 indicates the callback result is ignored. |
errMsg | "An error message" | Simple error message corresponding to the custom error code. |
errDlt | "Detailed error information" | Detailed error information corresponding to the custom error code. |
nextCode | 1 | Next step command, 1 indicates refusal to continue execution, set when actionCode is 0 . |