(
+ this: T,
+ event: P,
+ listener: (...args: ListenerType (
+ this: T,
+ event: P,
+ listener: (...args: ListenerType (
+ this: T,
+ event: P,
+ listener: (...args: any[]) => any
+ ): this;
+
+ removeAllListeners (this: T, event?: P): this;
+ listeners (this: T, event: P): Function[];
+ rawListeners (this: T, event: P): Function[];
+ listenerCount (this: T, event: P): number;
+}
+
+/** @zh-cn
+ * 文本消息接口,用于发送和接收文本消息。你可以调用 {@link RtmClient.sendMessageToPeer} 或 {@link RtmChannel.sendMessage} 发送点对点类型或频道类型的文本消息。
+ */
+/**
+ * Interface for text messages. You can use this interface to send and receive text messages. You can call {@link RtmClient.sendMessageToPeer} or {@link RtmChannel.sendMessage} to send a peer-to-peer or channel text message.
+ */
+interface RtmTextMessage {
+ /** @zh-cn
+ * 文本消息的内容。最大长度为 32 KB。
+ * Note Note Note Note Note Note Note Note Note Note Note Note Note Note Note Note Note 发送消息(包括点对点消息和频道消息)的频率上限为 180 次每 3 秒。 Note You can send messages, including peer-to-peer and channel messages at a maximum frequency of 180 calls every three second. Note Note: Note: This method updates the local user's attributes if it finds that the attributes has/have the same keys, or adds attributes to the local user if it does not.
+ *
+ * @param attributes The attributes to be added or updated.
+ * @return The Promise resolves after successfully adding or updating the local user's attributes.
+ */
+ addOrUpdateLocalUserAttributes(attributes: AttributesMap): Promise Note Note Note Note Note Note Note Note Note Note Note Note Note Note Note Note Note: The version `0.9.1` in the file name `agora-rtm-sdk-0.9.1.js` is for reference only, please use the latest version of the SDK.
+ */
+declare namespace AgoraRTM {
+ /** @zh-cn
+ * 不输出日志信息。
+ */
+ /**
+ * Do not output any log information.
+ */
+ const LOG_FILTER_OFF: LogFilterType;
+ /** @zh-cn
+ * 输出 ERROR 级别的日志信息。
+ */
+ /**
+ * Output ERROR level log information.
+ */
+ const LOG_FILTER_ERROR: LogFilterType;
+ /** @zh-cn
+ * 输出 ERROR、WARNING 和 INFO 级别的日志信息。 我们推荐你将日志级别设为该等级。
+ */
+ /**
+ * Output ERROR, WARNING, and INFO level log information.
+ */
+ const LOG_FILTER_INFO: LogFilterType;
+ /** @zh-cn
+ * 输出 ERROR 和 WARNING 级别的日志信息。
+ */
+ /**
+ * Output WARNING and INFO level log information.
+ */
+ const LOG_FILTER_WARNING: LogFilterType;
+ // const LOG_FILTER_DEBUG: LogFilterType;
+
+ /** @zh-cn
+ * Agora RTM SDK 的版本号。
+ */
+ /**
+ * Version of the Agora RTM SDK.
+ * @example `AgoraRTM.VERSION`
+ */
+ const VERSION: string;
+
+ /** @zh-cn
+ * Agora RTM SDK 的编译信息。
+ */
+ /**
+ * Compilation information of the Agora RTM SDK.
+ * @example `AgoraRTM.BUILD`
+ */
+ const BUILD: string;
+
+ const END_CALL_PREFIX: string;
+
+ /** @zh-cn
+ * 该方法创建并返回一个 {@link RtmClient} 实例。
+ * Agora RTM SDK 支持多个 {@link RtmClient} 实例。 {@link RtmClient} 类的所有接口函数都是异步调用。 The Agora RTM SDK supports creating multiple {@link RtmClient} instances. All methods in the {@link RtmClient} class are executed asynchronously. Agora RTM SDK 支持多个 {@link RtmClient} 实例。 {@link RtmClient} 类的所有接口函数都是异步调用。 The Agora RTM SDK supports creating multiple {@link RtmClient} instances. All methods in the {@link RtmClient} class are executed asynchronously.
+ *
+ */
+/**
+ * Interface for the peerId / online status key-value pair.
+ *
+ *
+ */
+interface PeersOnlineStatusResult {
+ [peerId: string]: boolean;
+}
+/** @zh-cn
+ * 表示频道名/频道人数键值对的接口。
+ */
+/**
+ * Interface for the channelId / channel member count key-value pair.
+ */
+interface ChannelMemberCountResult {
+ [channelId: string]: number;
+}
+
+/** @zh-cn
+ * RTM 客户端类。你可以通过 {@link AgoraRTM} 上的 {@link createInstance} 方法创建 RTM 客户端实例。Agora RTM SDK 的入口。
+ * @noInheritDoc
+ */
+/**
+ * Class that represents the RTM client. You can call the {@link createInstance} method of {@link AgoraRTM} to create an `RtmClient` instance. This class is the entry point of the Agora RTM SDK.
+ * @noInheritDoc
+ */
+declare class RtmClient extends EventEmitter
+ *
+ *
+ *
+ * @param options.token 可选的动态密钥,一般由客户的服务端获取。
+ * @return 该 Promise 会在登录成功后 resolve。
+ */
+ /**
+ * Logs in to the Agora RTM system.
+ *
+ * @note If you use the Agora RTM SDK together with the Agora RTC SDK, Agora recommends that you avoid logging in to the RTM system and joining the RTC channel at the same time.
+ * @note If the user logs in with the same uid from a different instance, the user will be kicked out of your previous login and removed from previously joined channels.
+ * @param options.uid The uid of the user logging in the Agora RTM system. The string length must be less than 64 bytes with the following character scope:number
类型。建议调用 toString()
方法转化非 string 型 uid。
+ *
+ *
+ *
+ * @param options.token An optional token generated by the app server.
+ * @return The Promise resolves after the user logs in to the Agora RTM system successfully.
+ */
+ login(options: { uid: string; token?: string }): Promisenumber
type and recommend using the toString()
method to convert your non-string uid.number
类型。建议调用 toString()
方法转化非 string 型 uid。
+ * @return 该 Promise 会在发送成功后 resolve。Promise 的值代表对方是否在线并接收成功。
+ */
+ /**
+ * Allows a user to send an (offline) peer-to-peer message to a specified remote user.
+ * number
type. We recommend using the toString()
method to convert a non-string uid.
+ * @return The Promise resolves after the message is successfully sent. The value of the Promise indicates whether the peer user is online and receives the message.
+ */
+ sendMessageToPeer(
+ message: RtmMessage,
+ peerId: string,
+ ): Promise
+ *
+ *
+ *
+ * @return 一个 {@link RtmChannel} 实例。
+ */
+ /**
+ * Creates an {@link RtmChannel} instance.
+ * @param channelId The unique channel name of the Agora RTM channel. The string length must be less than 64 bytes with the following character scope:
+ *
+ *
+ *
+ * @return An {@link RtmChannel} instance.
+ */
+ createChannel(channelId: string): RtmChannel;
+ /** @zh-cn
+ * 该方法创建一个 {@link LocalInvitation} 实例。
+ * @param calleeId 被叫的 uid。
+ * @return 一个 {@link LocalInvitation} 实例。
+ */
+ /**
+ * Creates a {@link LocalInvitation} instance.
+ * @param calleeId The uid of the callee.
+ * @return A {@link LocalInvitation} instance.
+ */
+ createLocalInvitation(calleeId: string): LocalInvitation;
+
+ /** @zh-cn
+ * 全量设置本地用户的属性。
+ *
+ * @param attributes 新的属性。
+ * @return 该 Promise 会在设置本地用户属性成功后 resolve。
+ */
+ /**
+ * Substitutes the local user's attributes with new ones.
+ *
+ * @param attributes The new attributes.
+ * @return The Promise resolves after successfully setting the local user's attributes.
+ */
+ setLocalUserAttributes(attributes: AttributesMap): Promise
+ *
+ *
+ * @param attributes 待增加或更新的属性列表。
+ * @return 该 Promise 会在添加或更新本地用户属性成功后 resolve。
+ */
+ /**
+ * Adds or updates the local user's attributes.
+ *
+ *
+ *
+ * @param channelIds 指定频道名列表。
+ */
+ /**
+ * Gets the member count of specified channels.
+ *
+ *
+ *
+ * @param channelIds An array of the specified channel IDs.
+ */
+ getChannelMemberCount(
+ channelIds: string[]
+ ): Promise
+ *
+ * @param channelId 该指定频道的 ID。
+ */
+ /**
+ * Gets all attributes of a specified channel.
+ *
+ *
+ *
+ * @param channelId The ID of the specified channel.
+ */
+ getChannelAttributes(channelId: string): Promise
+ *
+ * @param channelId 该指定频道的频道 ID。
+ * @param keys 频道属性名列表。
+ */
+ /**
+ * Gets the attributes of a specified channel by attribute keys.
+ *
+ *
+ *
+ * @param channelId The ID of the specified channel.
+ * @param keys An array of attribute keys.
+ */
+ getChannelAttributesByKeys(
+ channelId: string,
+ keys: string[]
+ ): Promise
+ *
+ * @param channelId 该指定频道的频道 ID。
+ * @param options 频道属性操作选项。详见 {@link ChannelAttributeOptions}。
+ */
+ /**
+ * Clears all attributes of a specified channel.
+ *
+ *
+ *
+ * @param channelId 该指定频道的 ID。
+ * @param attributeKeys 属性名列表。
+ * @param options 频道属性操作选项。详见 {@link ChannelAttributeOptions}。
+ */
+ /**
+ * Deletes the local user's attributes using attribute keys.
+ *
+ *
+ *
+ * @param channelId The channel ID of the specified channel.
+ * @param attributeKeys A list of channel attribute keys.
+ * @param options Options for this attribute operation. See {@link ChannelAttributeOptions}.
+ */
+ deleteChannelAttributesByKeys(
+ channelId: string,
+ attributeKeys: string[],
+ options?: ChannelAttributeOptions
+ ): Promise
+ *
+ *
+ *
+ * @param channelId 该指定频道的 ID。
+ * @param attributes 待增加或更新的属性列表。
+ * @param options 频道属性操作选项。详见 {@link ChannelAttributeOptions}。
+ */
+ /**
+ * Adds or updates the attributes of a specified channel.
+ *
+ * This method updates the specified channel's attributes if it finds that the attributes has/have the same keys, or adds attributes to the channel if it does not.
+ *
+ *
+ *
+ * @param channelId The channel ID of the specified channel.
+ * @param attributes An array of channel attributes.
+ * @param options Options for this attribute operation. See {@link ChannelAttributeOptions}.
+ */
+ addOrUpdateChannelAttributes(
+ channelId: string,
+ attributes: AttributesMap,
+ options?: ChannelAttributeOptions
+ ): Promise
+ *
+ * @param channelId 该指定频道的频道 ID。
+ * @param attributes 频道属性列表实例。
+ * @param options 频道属性操作选项。详见 {@link ChannelAttributeOptions}。
+ */
+ /**
+ * Sets the attributes of a specified channel with new ones.
+ *
+ *
+ *
+ * @param channelId The channel ID of the specified channel.
+ * @param attributes An array of channel attributes.
+ * @param options Options for this attribute operation. See {@link ChannelAttributeOptions}.
+ */
+ setChannelAttributes(
+ channelId: string,
+ attributes: AttributesMap,
+ options?: ChannelAttributeOptions
+ ): Promise
+ *
+ *
+ *
+ * @param peerIds
+ */
+ /**
+ * Subscribes to the online status of the specified users.
+ *
+ *
+ *
+ *
+ * @param peerIds An array of the specified user IDs.
+ */
+ subscribePeersOnlineStatus(peerIds: string[]): Promise