User Online Status Callback
Function Description
The App business server can use this callback to change the user's status to online.
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 login request to go online through the client.
- When the user's client successfully reconnects after a disconnection.
- When setting a user's custom status.
Timing of Callback
- When a user goes online.
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: callbackUserOnlineCommand |
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": "callbackUserOnlineCommand",
"seq": 123456,
"isAppBackground": false,
"connID": "conn123"
}
Request Package Field Description
Field | Type | Description |
---|---|---|
userID | string | Unique identifier of the user. |
callbackCommand | string | Callback command, here for user online status callback. |
seq | int64 | Request sequence number. |
isAppBackground | bool | Indicates if the user is in the app background. |
connID | string | Connection identifier of the user. |
Response Package Example
Processing Result
User is online.
{
"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 . |