@rongcloud/engine 5.1.1 → 5.1.2-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
- * RCEngine - v5.1.1
3
- * CommitId - 41dbe38d1b376ca0a791b23ed94be291e3f92e81
4
- * Mon Jan 17 2022 19:48:11 GMT+0800 (China Standard Time)
2
+ * RCEngine - v5.1.2-alpha.1
3
+ * CommitId - 57675679fa08a996d0cfcf4d8504dd7b35e59cb5
4
+ * Mon Feb 14 2022 20:03:28 GMT+0800 (China Standard Time)
5
5
  * ©2020 RongCloud, Inc. All rights reserved.
6
6
  */
7
7
  /**
@@ -1683,6 +1683,10 @@ interface IBaseConversationInfo {
1683
1683
  targetId: string;
1684
1684
  channelId: string;
1685
1685
  }
1686
+ interface IConversationState extends IBaseConversationInfo {
1687
+ unreadCount: number;
1688
+ unreadMentionedCount: number;
1689
+ }
1686
1690
 
1687
1691
  /**
1688
1692
  * 导航信息数据就结构
@@ -2167,6 +2171,10 @@ interface IRTCUsers {
2167
2171
  * 发布的资源数据,是一个 JSON 字符串,解析后为发布的资源列表
2168
2172
  */
2169
2173
  uris?: string;
2174
+ /**
2175
+ * 加房间的身份标识,保存主房间 roomId
2176
+ */
2177
+ extra?: string;
2170
2178
  };
2171
2179
  };
2172
2180
  }
@@ -2859,8 +2867,9 @@ interface IEngine {
2859
2867
  * 建立连接
2860
2868
  * @param token
2861
2869
  * @param naviInfo
2870
+ * @param reconnectKickEnable
2862
2871
  */
2863
- connect(token: string, naviInfo: INaviInfo, versionInfo: string): Promise<ErrorCode>;
2872
+ connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
2864
2873
  /**
2865
2874
  * 上报版本信息
2866
2875
  * @param version
@@ -3035,8 +3044,9 @@ interface IEngine {
3035
3044
  * @param isPersited 是否存储
3036
3045
  * @param isCounted 是否技术
3037
3046
  * @param searchProps 搜索字段,只在搭配协议栈使用时有效
3047
+ * @param isStatusMessage 是否是状态消息
3038
3048
  */
3039
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
3049
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[], isStatusMessage: boolean): void;
3040
3050
  /**
3041
3051
  * 加入聊天室
3042
3052
  * @param count 拉取消息数量
@@ -3687,7 +3697,10 @@ declare class DataCodec {
3687
3697
  /**
3688
3698
  * 加入 RTC 房间
3689
3699
  */
3690
- encodeJoinRTCRoom(mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): any[];
3700
+ encodeJoinRTCRoom(mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, extraUserData?: {
3701
+ key: string;
3702
+ value: string;
3703
+ }): any[];
3691
3704
  /**
3692
3705
  * 退出 RTC 房间
3693
3706
  */
@@ -3975,8 +3988,8 @@ interface IWatcher {
3975
3988
  pullFinished?: ITagListener;
3976
3989
  onConnecting?: () => void;
3977
3990
  onConnected?: () => void;
3978
- onDisconnect?: () => void;
3979
- onSuspend?: () => void;
3991
+ onDisconnect?: (status: ConnectionStatus) => void;
3992
+ onSuspend?: (status: ConnectionStatus) => void;
3980
3993
  readReceiptReceived?: (conversation: IConversationOption, messageUId: string, sentTime: number) => void;
3981
3994
  messageReceiptRequest?: (conversation: IConversationOption, messageUId: string, senderUserId: string) => void;
3982
3995
  messageReceiptResponse?: (conversation: IConversationOption, receivedUserId: string, messageUIdList: string[]) => void;
@@ -4093,8 +4106,8 @@ declare class APIContext {
4093
4106
  private _connectionStatusListener;
4094
4107
  _handleConnecting(): void;
4095
4108
  _handleConnected(): void;
4096
- _handleDisconnect(): void;
4097
- _handleSuspend(): void;
4109
+ _handleDisconnect(status: ConnectionStatus): void;
4110
+ _handleSuspend(status: ConnectionStatus): void;
4098
4111
  private _messageReceiver;
4099
4112
  _batchMessageReceiver(messages: IReceivedMessage[], leftCount?: number, hasMore?: boolean): void;
4100
4113
  /**
@@ -4156,14 +4169,22 @@ declare class APIContext {
4156
4169
  * 建立连接,连接失败则抛出异常,连接成功后返回用户 userId,否则返回相应的错误码
4157
4170
  * @param token
4158
4171
  * @param refreshNavi 是否需要重新请求导航,当值为 `false` 时,优先使用有效缓存导航,若缓存失效则重新获取导航
4172
+ * @param reconnectKickEnable 设置断线重连时是否踢出当前正在重连的设备 (仅 Electron 环境有效)
4173
+ * 同一个账号在一台新设备上登录的时候,会把这个账号在之前登录的设备上踢出。
4174
+ 由于 SDK 有断线重连功能,存在下面情况。
4175
+ 用户在 A 设备登录,A 设备网络不稳定,没有连接成功,SDK 启动重连机制。
4176
+ 用户此时又在 B 设备登录,B 设备连接成功。
4177
+ A 设备网络稳定之后,用户在 A 设备连接成功,B 设备被踢出。
4178
+ 这个字段就是为这种情况加的。
4179
+ 设置 reconnectKickEnable 为 true 时,SDK 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
4159
4180
  */
4160
- connect(token: string, refreshNavi?: boolean): Promise<IConnectResult>;
4181
+ connect(token: string, refreshNavi?: boolean, reconnectKickEnable?: boolean): Promise<IConnectResult>;
4161
4182
  /**
4162
4183
  * 拉取实时配置 web 端需更新 voipCall 字段
4163
4184
  */
4164
4185
  private _pullUserSettings;
4165
4186
  disconnect(): Promise<void>;
4166
- reconnect(): Promise<IConnectResult>;
4187
+ reconnect(reconnectKickEnable?: boolean): Promise<IConnectResult>;
4167
4188
  private _getTokenWithoutNavi;
4168
4189
  /**
4169
4190
  * 获取当前缓存的导航数据
@@ -4176,8 +4197,9 @@ declare class APIContext {
4176
4197
  * @param isPersited 是否存储
4177
4198
  * @param isCounted 是否技术
4178
4199
  * @param searchProps 搜索字段,只在搭配协议栈使用时有效
4200
+ * @param isStatusMessage 是否是状态消息
4179
4201
  */
4180
- registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[]): void;
4202
+ registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps?: string[], isStatusMessage?: boolean): void;
4181
4203
  /**
4182
4204
  * 发送消息
4183
4205
  * @param conversationType
@@ -4495,6 +4517,10 @@ declare class APIContext {
4495
4517
  * 获取所有群聊会话 @ 消息未读数
4496
4518
  */
4497
4519
  getAllUnreadMentionedCount(): Promise<IAsyncRes<number>>;
4520
+ /**
4521
+ * 获取本地全部会话的状态
4522
+ */
4523
+ getAllConversationState(): Promise<IAsyncRes<IConversationState[]>>;
4498
4524
  /**
4499
4525
  * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
4500
4526
  * 对于未实现的方法,接口响应 Unsupport 错误码
@@ -4601,7 +4627,10 @@ declare class APIContext {
4601
4627
  * @param mode 房间模式:直播 or 会议
4602
4628
  * @param mediaType 直播房间模式下的媒体资源类型
4603
4629
  */
4604
- joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number, joinType?: RTCJoinType): Promise<IAsyncRes<IJoinRTCRoomData>>;
4630
+ joinRTCRoom(roomId: string, mode: RTCMode, mediaType?: number, joinType?: RTCJoinType, extraUserData?: {
4631
+ key: string;
4632
+ value: string;
4633
+ }): Promise<IAsyncRes<IJoinRTCRoomData>>;
4605
4634
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
4606
4635
  rtcPing(roomId: string, mode: number, mediaType?: number): Promise<ErrorCode>;
4607
4636
  getRTCRoomInfo(roomId: string): Promise<IAsyncRes<IRTCRoomInfo>>;
@@ -4668,6 +4697,14 @@ declare class APIContext {
4668
4697
  declare class PluginContext {
4669
4698
  protected readonly _context: APIContext;
4670
4699
  constructor(_context: APIContext);
4700
+ /**
4701
+ * 获取 context
4702
+ */
4703
+ __getContext(): APIContext;
4704
+ /**
4705
+ * 获取当前的导航数据
4706
+ */
4707
+ getNaviInfo(): INaviInfo | null;
4671
4708
  /**
4672
4709
  * 接收 IM 服务推送的消息,并通过返回 boolean 值决定此消息是否拦截
4673
4710
  * @param message
@@ -4751,8 +4788,12 @@ declare class RTCPluginContext extends PluginContext {
4751
4788
  * @param roomId
4752
4789
  * @param mode 房间模式:直播 or 会议
4753
4790
  * @param broadcastType
4791
+ * @param extraUserData 加副房间时的主房间 Id
4754
4792
  */
4755
- joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): IPromiseResult<IJoinRTCRoomData>;
4793
+ joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, extraUserData?: {
4794
+ key: string;
4795
+ value: string;
4796
+ }): IPromiseResult<IJoinRTCRoomData>;
4756
4797
  quitRTCRoom(roomId: string): Promise<ErrorCode>;
4757
4798
  rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
4758
4799
  getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
@@ -4933,8 +4974,9 @@ declare abstract class AEngine implements IEngine {
4933
4974
  * 建立连接
4934
4975
  * @param token
4935
4976
  * @param naviInfo
4977
+ * @param reconnectKickEnable
4936
4978
  */
4937
- abstract connect(token: string, naviInfo: INaviInfo): Promise<ErrorCode>;
4979
+ abstract connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
4938
4980
  /**
4939
4981
  * 发送SDK版本
4940
4982
  * @param versionInfo
@@ -5119,8 +5161,9 @@ declare abstract class AEngine implements IEngine {
5119
5161
  * @param isPersited 是否存储
5120
5162
  * @param isCounted 是否技术
5121
5163
  * @param searchProps 搜索字段,只在搭配协议栈使用时有效
5164
+ * @param isStatusMessage 是否是状态消息
5122
5165
  */
5123
- abstract registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[]): void;
5166
+ abstract registerMessageType(objectName: string, isPersited: boolean, isCounted: boolean, searchProps: string[], isStatusMessage: boolean): void;
5124
5167
  /**
5125
5168
  * 加入聊天室
5126
5169
  * @param count 拉取消息数量
@@ -5408,7 +5451,14 @@ declare abstract class AEngine implements IEngine {
5408
5451
  * 获取所有群聊会话 @ 消息未读数
5409
5452
  */
5410
5453
  abstract getAllUnreadMentionedCount(): Promise<IAsyncRes<number>>;
5411
- abstract joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType): IPromiseResult<IJoinRTCRoomData>;
5454
+ /**
5455
+ * 获取本地全部会话的状态
5456
+ */
5457
+ abstract getAllConversationState(): Promise<IAsyncRes<IConversationState[]>>;
5458
+ abstract joinRTCRoom(roomId: string, mode: RTCMode, broadcastType?: number, joinType?: RTCJoinType, extraUserData?: {
5459
+ key: string;
5460
+ value: string;
5461
+ }): IPromiseResult<IJoinRTCRoomData>;
5412
5462
  abstract quitRTCRoom(roomId: string): Promise<ErrorCode>;
5413
5463
  abstract rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<ErrorCode>;
5414
5464
  abstract getRTCRoomInfo(roomId: string): IPromiseResult<IRTCRoomInfo>;
@@ -5920,4 +5970,4 @@ declare enum CONNECTION_TYPE {
5920
5970
  */
5921
5971
  declare const version: string;
5922
5972
 
5923
- export { AEngine, ANavi, APIContext, AppStorage, AssertRules, CONNECTION_TYPE, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, ChatroomUserChangeType as ChatroomMemberChangeType, CometChannel, ConnectResultCode, ConnectionStatus, ConversationType, DelayTimer, ErrorCode, EventEmitter, FileType, HttpMethod, IAPIContextOption, IAsyncRes, IBaseConversationInfo, IBlockedMessageInfo, ICancelRoomPKOptions, IChatRoomEntries, IChatRoomEntry, IChatroomEntries, IChatroomEntry, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChrmKVEntries, IChrmKVEntry, IConnectResult, IConnectionStatusListener, IConversationOption, IConversationStateListener, IConversationTag, IConversationTagListener, IDataChannelWatcher, IDeletedExpansion, IEndRoomPKOptions, IEngine, IEngineWatcher, IEventListener, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IInsertMsgOptions, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, IM_COMET_PULLMSG_TIMEOUT, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviInfo, IPluginGenerator, IPromiseResult, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomInfo, IRTCUsers, IReadReceiptInfo, IRecallMsgOptions, IReceivedConversation, IReceivedConversationByTag, IReceivedMessage, IRemoveChatRoomEntries, IRemoveChatRoomEntry, IRemoveChatroomEntries, IRemoveChatroomEntry, IReqRoomPKOptions, IRequest, IResRoomPKOptions, IResponse, IRtcTokenData, IRuntime, ISendExMsgOptions, ISendMsgOptions, IServerConversationStatus, IServerRTCRoomEntry, IServerUserSetting, ISetConversationStatusOptions, IStorage, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserProfile, IWatcher, IWebSocket, ItypingStateListener, KVString, LiveRole, LiveType, LogLevel, LogType, Logger, MAX_MESSAGE_CONTENT_BYTES, MINI_COMET_CONNECT_URIS, MINI_SOCKET_CONNECT_URIS, MentionedType, MessageBlockType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NotificationStatus, PING_REQ_TIMEOUT, PUBLIC_CLOUD_NAVI_URIS, PluginContext, RCAssertError, RTCApiType, RTCIdentityChangeType, RTCJoinType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATUS_MESSAGE, STORAGE_ROOT_KEY, TagChangeType, UploadMethod, VersionManage, WEB_SOCKET_TIMEOUT, WebSocketChannel, appendUrl, assert, cloneByJSON, forEach, formatConnectResponseCode, getBrowser, getMimeKey, getUploadFileName, indexOf, isArray, isArrayBuffer, isBoolean, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isUndefined, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidFileType, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, usingCppEngine, validate, version };
5973
+ export { AEngine, ANavi, APIContext, AppStorage, AssertRules, CONNECTION_TYPE, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, ChatroomUserChangeType as ChatroomMemberChangeType, CometChannel, ConnectResultCode, ConnectionStatus, ConversationType, DelayTimer, ErrorCode, EventEmitter, FileType, HttpMethod, IAPIContextOption, IAsyncRes, IBaseConversationInfo, IBlockedMessageInfo, ICancelRoomPKOptions, IChatRoomEntries, IChatRoomEntry, IChatroomEntries, IChatroomEntry, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChrmKVEntries, IChrmKVEntry, IConnectResult, IConnectionStatusListener, IConversationOption, IConversationState, IConversationStateListener, IConversationTag, IConversationTagListener, IDataChannelWatcher, IDeletedExpansion, IEndRoomPKOptions, IEngine, IEngineWatcher, IEventListener, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IInsertMsgOptions, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, IM_COMET_PULLMSG_TIMEOUT, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviInfo, IPluginGenerator, IPromiseResult, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomInfo, IRTCUsers, IReadReceiptInfo, IRecallMsgOptions, IReceivedConversation, IReceivedConversationByTag, IReceivedMessage, IRemoveChatRoomEntries, IRemoveChatRoomEntry, IRemoveChatroomEntries, IRemoveChatroomEntry, IReqRoomPKOptions, IRequest, IResRoomPKOptions, IResponse, IRtcTokenData, IRuntime, ISendExMsgOptions, ISendMsgOptions, IServerConversationStatus, IServerRTCRoomEntry, IServerUserSetting, ISetConversationStatusOptions, IStorage, ITagInfo, ITagListener, ITagParam, ITagStatus, ITypingInfo, ITypingMessage, ITypingUser, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserProfile, IWatcher, IWebSocket, ItypingStateListener, KVString, LiveRole, LiveType, LogLevel, LogType, Logger, MAX_MESSAGE_CONTENT_BYTES, MINI_COMET_CONNECT_URIS, MINI_SOCKET_CONNECT_URIS, MentionedType, MessageBlockType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NotificationStatus, PING_REQ_TIMEOUT, PUBLIC_CLOUD_NAVI_URIS, PluginContext, RCAssertError, RTCApiType, RTCIdentityChangeType, RTCJoinType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATUS_MESSAGE, STORAGE_ROOT_KEY, TagChangeType, UploadMethod, VersionManage, WEB_SOCKET_TIMEOUT, WebSocketChannel, appendUrl, assert, cloneByJSON, forEach, formatConnectResponseCode, getBrowser, getMimeKey, getUploadFileName, indexOf, isArray, isArrayBuffer, isBoolean, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isUndefined, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidFileType, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, usingCppEngine, validate, version };