• UIKit
  • SDK
  • 서버 API
Chat/
SDK/
Unity(Game Solution)/
그룹/
SDK
  • Run Demo
  • SDK 통합
  • 초기화
  • 로그인 및 로그아웃
  • 메시지
    • 메시지 개요
    • 메시지 보내기
    • 메시지 받기
    • 과거 메시지
    • 메시지 전달
    • 메시지 수정
    • 메시지 삭제
    • 메시지 비우기
    • 메시지 철회
    • 온라인 메시지
    • 읽음 확인
    • 메시지 조회
    • 그룹 @ 메시지
    • 지향적 그룹 메시지
    • 알림 음소거
    • 메시지 확장
  • 대화
    • 대화 개요
    • 대화 목록
    • 대화 획득
    • 읽지 않은 대화 수
    • 대화 최상단 고정
    • 대화 삭제
    • 대화 초안
    • 대화 마크
    • 대화 그룹
  • 그룹
    • 그룹 개요
    • 그룹 관리
    • 그룹 정보
    • 그룹 멤버 관리
    • 그룹 멤버 정보
    • 그룹 속성 사용자 정의
    • 그룹 카운터
  • 사용자
    • 사용자 정보
    • 사용자 상태
    • 친구 관리
    • 친구 목록
    • 블록리스트
  • Changelog
  • Guideline for Beginners
  • 콘솔 안내
    • 애플리케이션 생성 및 업그레이드
    • 기본 구성
    • 기능 구성
    • 계정 관리
    • 그룹 관리
    • 콜백 구성
  • 제품 소개
    • 메시지 관리
      • 1대1 메시지
      • 메시지 저장
      • 오프라인 푸시
      • 그룹 메시지
      • 메시지 포맷
    • 계정 시스템
      • 로그인 인증
      • 온라인 상태 관리
    • 그룹 관련
      • 그룹 시스템
      • 그룹 관리
    • 사용자 정보 및 관계망
      • 정보 관리
      • 관계망 관리
  • 구매 가이드
    • 과금 개요
    • 가격
  • 에러코드
이 페이지는 현재 영어로만 제공되며 한국어 버전은 곧 제공될 예정입니다. 기다려 주셔서 감사드립니다.

그룹 카운터

Overview

Starting from native SDK v7.0, Tencent Cloud Chat SDK provides the group counter feature. You can configure a certain number of counters for each group.
Unlike custom group attributes, group counters are used to store data of integer type. Group counters can be used to store additional information related to a group, such as the cumulative number of viewers, the number of views, the number of likes, and the number of gifts the audience has given to the host of an audio-video group.
Note:
Group counters support all types of groups, excluding topic-enabled community groups.
The group counter feature is supported only by the Ultimate edition.
Keep the following in mind for group counters:
1. A single group supports up to 20 group counters, that is, up to 20 keys per group.
2. For a single group counter, the key can contain up to 128 bytes, and the value must be of integer type (signed integer of up to 64 bits).
3. The GroupSetGroupCounters, GroupIncreaseGroupCounter, and GroupDecreaseGroupCounter APIs together can be called by a logged-in user up to 20 times every five seconds in the SDK, and the 8516 error code will be called back if the limit is exceeded.
4. The GroupGetGroupCounters API can be called by a logged-in user up to 20 times every five seconds in the SDK, and the 8516 error code will be called back if the limit is exceeded.


Setting Group Counters

Call the GroupSetGroupCounters (details) API to set group counters. After group counters are set, the GroupCounterChangedCallback (details) callback will be triggered. For the usage of the GroupCounterChangedCallback callback, see Group Counter Change Notification.
Note:
If the key of the group counter to be set already exists, the value of key is updated directly. Otherwise, a key-value pair will be added.
If multiple users set the same counter at the same time, the final value of the counter will be used. It's recommended that the group owner performs counter setting operations.
Sample: Call the GroupSetGroupCounters API to set the values of counters key1 and key2 to 0
// Set a group counter
List<GroupCounter> list = new List<GroupCounter>
{
new GroupCounter
{
group_counter_key = "key",
group_counter_value = 1
}
};
TIMResult res = TencentIMSDK.GroupSetGroupCounters("groupID", list, (int code, string desc, List<GroupCounter> results, string user_data)=>{
// Async result of the group counter setting
});


Incrementing the Value of a Group Counter

Call the GroupIncreaseGroupCounter (details) API to increment the value of a group counter. After the value of the group counter is incremented, the GroupCounterChangedCallback (details) callback will be triggered. For the usage of the GroupCounterChangedCallback callback, see Group Counter Change Notification.
Note:
The API parameter value is the change value. Each time when the API is called, the current value is incremented by the value passed in.
If the key of the group counter to be set already exists, the current value is directly incremented by the value passed in. Otherwise, a key will be added, and the default value (0) is incremented by the value passed in.
Sample: Assume that the current value of counter key1 is 8. After you call the GroupIncreaseGroupCounter API to pass in an increment value 2, the final value of key1 becomes 10.
// Increment the value of a group counter
TIMResult res = TencentIMSDK.GroupIncreaseGroupCounter("groupID", "key1", 2, (int code, string desc, List<GroupCounter> results, string user_data)=>{
// Async result of the group counter increment
});


Decrementing the Value of a Group Counter

Call the GroupDecreaseGroupCounter (details) API to decrement the value of a group counter. After the value of the group counter is decremented, the GroupCounterChangedCallback (details) callback will be triggered. For the usage of the GroupCounterChangedCallback callback, see Group Counter Change Notification.
Note:
The API parameter value is the change value. Each time when the API is called, the current value is decreased by the value passed in.
If the key of the group counter to be set already exists, the current value is directly decremented by the value passed in. Otherwise, a key will be added, and the default value (0) is decreased by the value passed in.
Sample: Assume that the current value of counter key1 is 8. After you call the GroupDecreaseGroupCounter API to pass in a decrement value 2, the final value of key1 becomes 6.
// Decrement the value of a group counter
TIMResult res = TencentIMSDK.GroupDecreaseGroupCounter("groupID", "key1", 2, (int code, string desc, List<GroupCounter> results, string user_data)=>{
// Async result of the group counter decrement
});


Getting Group Counters

Call the GroupGetGroupCounters (details) API to pass in a set of keys to get the information of the corresponding group counters. The API will return all key-value pairs matching the keys passed in.
Note:
If the key list passed in is empty, all group counters are returned.
Sample: Call the GroupGetGroupCounters`` API to get the values of counters key1 and key2`
// Get group counters
TIMResult res = TencentIMSDK.GroupGetGroupCounters("groupID", new List<string> {"key1", "key2"}, (int code, string desc, List<GroupCounter> results, string user_data)=>{
// Async result of the group counter getting
});


Group Counter Change Notification

When you call the GroupSetGroupCounters, GroupIncreaseGroupCounter, or GroupDecreaseGroupCounter API to modify group counters, the SDK will trigger the GroupCounterChangedCallback callback and return the updated values of value.
Note:
Before you can invoke the above-mentioned callback, you need to call the SetGroupCounterChangedCallback (details) API to add a group listener.
Sample code:
// Set the group counter change callback
TencentIMSDK.SetGroupCounterChangedCallback((string group_id, string group_counter_key, ulong group_counter_new_value, string user_data) => {
});