TIMSetNetworkStatusListenerCallback

Introduction

Set network status changed callback

When called TIMInit, 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
params TIMSetNetworkStatusListenerCallbackParam yes Param of setting network status changed callback

Returned template

void

Return value details

This function has no return value

Code example

import TimRender from "im_electron_sdk/dist/renderer";
const timRenderInstance = new TimRender();
import { TIMSetNetworkStatusListenerCallbackParam } from "im_electron_sdk/dist/interfaces";

let param: TIMSetNetworkStatusListenerCallbackParam = {
    userData: "",   // required
    callback: (data) => { }  // required
};
timRenderInstance.TIMSetNetworkStatusListenerCallback(param)

results matching ""

    No results matching ""