TIMSubscribeUserStatus

Introduction

subscribe user's status

After successfully subscribing to the user status, when the other party's status (including online status and custom status) changes, you can monitor the TIMSetUserStatusChangedCallback callback to perceive

If you need to subscribe to the status of the friend list, you only need to turn on the switch on the console, without calling this interface

This interface does not support subscribing to itself, you can perceive the change of your own custom status by listening to the TIMSetUserStatusChangedCallback callback

There is a limit on the number of subscription lists. After the limit is exceeded, the first subscribed user will be automatically eliminated

Parameter details

Parameter name Parameter type Required Description
userStatusParam userStatusParam yes user status param

Returned template

Promise<commonResult<string>>

{
    code: TIMResult | TIMErrCode;
    desc?: string | undefined;
    json_param?: string | undefined;
    json_params?: string | undefined; 
    user_data?: string | undefined;
}

Return value details

name type description
code TIMResultTIMErrCode Request result: Error codes. 0 means success.
desc string | undefined The description of the error. It will be empty if success.
json_param string | undefined Return value of calling API
json_params string | undefined Return value of calling API. Compatible field, which is returned in some cases.
user_data string | undefined ImSDK is responsible for transporting user-defined data without any processing

Code example

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

let userID = ''
let param:userStatusParam = {
    id_array:[userID],
    user_data:""
}
let {code} = timRenderInstance.TIMSubscribeUserStatus(param)
if(code == 0){
    //success
}

results matching ""

    No results matching ""