setGroupCounters

Introduction

Set the group counters.

This method only works with Ultimate Edition, you can find the pricing plan here.

A single group supports up to 20 group counters, which means the number of keys in a single group does not exceed 20.

The key of a single group counter does not exceed 128 bytes, and the value must be an integer type (maximum support for 64-bit signed integer).

The setGroupCounters, increaseGroupCounter, and decreaseGroupCounter interfaces are merged and calculated. The SDK limits a maximum of 20 calls within 5 seconds for a single logged-in user. If the limit is exceeded, the interface will return error code 8516.

If the key of the counter you are about to set already exists, the value of the counter will be updated directly. If it does not exist, the key-value will be added directly.

If multiple users set the same counter at the same time, the final value of the counter will overwrite each other. It is recommended that the group owner initiate the setting operation.

Works since version 1.0.25

Parameter details

Parameter name Parameter type Required Description
groupID string yes The group ID.
counters NumberMap yes The counters to set.

Returned template

V2TimValueCallback<Map<String, number>>

{
    code : number
    desc : string
    data : Map<String, number>
}

Return value details

name type description
code number Request result: Error codes. 0 means success.
desc string The description of the error. It will be empty if success.
data Result list of setting group counters operation.

Code example

import { TencentImSDKPlugin } from 'react-native-tim-js';

const SetGroupCountersresponse = await TencentImSDKPlugin.v2TIMManager
    .getGroupManager()
    .setGroupCounters(
        groupID,
        counters
    );
if (SetGroupCountersresponse.code === 0) {

    SetGroupCountersresponse.data;
}

results matching ""

    No results matching ""