AgoraChatSDK 1.2.0
Instance Methods | List of all members
<IAgoraChatStatisticsManager> Protocol Reference

#import <IAgoraChatStatisticsManager.h>

Inheritance diagram for <IAgoraChatStatisticsManager>:

Instance Methods

(AgoraChatMessageStatistics *_Nullable) - getMessageStatisticsById:
 
(NSInteger) - getMessageCountWithStart:end:direction:type:
 
(NSInteger) - getMessageStatisticsSizeWithStart:end:direction:type:
 

Detailed Description

The protocol that defines statistical operations of message traffic.

This protocol contains methods that are used to calculate the number of local messages of certain types sent and/or received in a specified period, as well as their traffic.

This traffic statistics function is disabled by default. To use this function, you need to enable it by setting AgoraChatOptions#enableStatistics prior to the SDK initialization. The SDK can collect statistics of messages that are sent and received after this function is enabled.

The SDK only calculates the traffic of messages that are sent and received within the last 30 days after the traffic statistics function is enabled.

The message traffic is calculated as follows:

Note
  1. For messages with attachments, the traffic will be calculated only if the download is successful. If an attachment is downloaded multiple times, its download traffic will be accumulated.
  2. For roaming messages pulled from the server, if they already exist in the local database, the SDK ignores them during traffic calculation.

The SDK only measures the traffic of local messages, but not the actual message traffic. Generally, the calculated traffic volume is smaller than the actual traffic because of the following:

Method Documentation

◆ getMessageCountWithStart:end:direction:type:

- (NSInteger) getMessageCountWithStart: (NSInteger)  startTimestamp
end: (NSInteger)  endTimestamp
direction: (AgoraChatMessageStatisticsDirection)  direction
type: (AgoraChatMessageStatisticsType)  type 
required

Gets the count of messages of certain types that are sent and/or received in a specified period.

Parameters
startTimestampThe starting timestamp for statistics. The unit is millisecond.
endTimestampThe ending timestamp for statistics. The unit is millisecond.
directionThe message direction.
typeThe message type.
Returns
The count of messages that meet the statistical conditions. 0 is returned in the case of a call failure.

◆ getMessageStatisticsById:

- (AgoraChatMessageStatistics *_Nullable) getMessageStatisticsById: (NSString *_Nonnull)  messageId
required

Gets the message traffic statistics by message ID.

Parameters
messageIdThe message ID.
Returns
The message traffic statistics.

◆ getMessageStatisticsSizeWithStart:end:direction:type:

- (NSInteger) getMessageStatisticsSizeWithStart: (NSInteger)  startTimestamp
end: (NSInteger)  endTimestamp
direction: (AgoraChatMessageStatisticsDirection)  direction
type: (AgoraChatMessageStatisticsType)  type 
required

Gets the total traffic amount of messages that meet the statistical conditions.

The traffic is measured in bytes.

Parameters
startTimestampThe starting timestamp for statistics. The unit is millisecond.
endTimestampThe ending timestamp for statistics. The unit is millisecond.
directionThe message direction.
typeThe message type.
Returns
The total traffic amount of messages that meet the statistical conditions. 0 is returned in the case of a call failure.

The documentation for this protocol was generated from the following file: