Skip to main content

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

ParameterDescription
httpsThe request protocol is HTTPS, and the method is POST.
https://callbackurlCallback URL
CallbackCommandFixed value: callbackUserOfflineCommand
contenttypeFixed value: JSON
Header NameExample ValueOptionalTypeDescription
operationID1646445464564RequiredstringoperationID for global link tracing

Request Package Example

{
"userID": "user123",
"callbackCommand": "callbackUserOfflineCommand",
"seq": 123456,
"connID": "conn123"
}

Request Package Field Description

FieldTypeDescription
userIDstringUnique identifier of the user.
callbackCommandstringCallback command, here for user offline status callback.
seqint64Request sequence number.
connIDstringConnection identifier of the user.

Response Package Example

Processing Result

User is offline.

{
"actionCode": 0,
"errCode": 0,
"errMsg": "",
"errDlt": "",
"nextCode": ""
}

Response Package Field Description

FieldValueDescription
actionCode0Indicates whether the business system's callback was executed correctly. 0 means the operation was successful.
errCode0Custom 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.
nextCode1Next step command, 1 indicates refusal to continue execution, set when actionCode is 0.