SetNetworkStatusListenerCallback
introduction
Set network status changed callback
When called Init, ImSDK will connect the server and listen to network staus.
Network status contains four stages: Connecting, Failed, Connect Success, Connected. The network status is only responsible for the indication of the connection between ImSDK and the IM server.
This is optional callback, if you concern about network status changing, use this callback to inform the conncetion is connected or broke. Besides, you can set callback to retrieve mesasges once reconnected.
Once logged in, ImSDK will attemp reconnect automatically
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
callback | NetworkStatusListenerCallback | yes | NetworkStatusListenerCallback |
Returned template
TIMResult
The parameters of the callback function after successfully calling the API:
code:int
desc:string
json_param:'' // json_ Params is an empty string ""
user_data:string
Return value details
name | type | description |
---|---|---|
TIMResult | TIMResult | Return value of calling API |
code | int | Result error code: Error Codes |
desc | string | The description of the error. |
json_param | string | Json string. Calling different API will get different Json strings. |
user_data | string | User-defined data transfered by ImSDK without any processing |