@rongcloud/engine 5.6.2-beem.5 → 5.7.0

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.
Files changed (4) hide show
  1. package/index.d.ts +1063 -1380
  2. package/index.esm.js +1 -1
  3. package/index.js +1 -1
  4. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -102,154 +102,6 @@ declare enum TagChangeType {
102
102
  delete = 3
103
103
  }
104
104
 
105
- /**
106
- * 通信协议中 fixHeader 第一个字节中的 Qos 数据标识
107
- * ```
108
- * fixHeader:command(4 bit) | dup(1 bit) | Qos(2 bit) | retain(1 bit)
109
- * ```
110
- */
111
- declare enum QOS {
112
- AT_MOST_ONCE = 0,
113
- AT_LEAST_ONCE = 1,
114
- EXACTLY_ONCE = 2,
115
- DEFAULT = 3
116
- }
117
- /**
118
- * 通信协议中 fixHeader 第一个字节中的 command 数据标识,用于判断操作类型
119
- * ```
120
- * fixHeader:command(4 bit) | dup(1 bit) | Qos(2 bit) | retain(1 bit)
121
- * ```
122
- */
123
- declare enum OperationType {
124
- /** 私有云专用,解密协商指令 */
125
- SYMMETRIC = 0,
126
- /** 连接请求 */
127
- CONNECT = 1,
128
- /** 连接应答 */
129
- CONN_ACK = 2,
130
- /** 上行发送消息 */
131
- PUBLISH = 3,
132
- /** 上行发送消息的应答 */
133
- PUB_ACK = 4,
134
- /** 上行拉消息 */
135
- QUERY = 5,
136
- /** 上行拉消息的应答 */
137
- QUERY_ACK = 6,
138
- /** QueryConfirm */
139
- QUERY_CONFIRM = 7,
140
- SUBSCRIBE = 8,
141
- SUB_ACK = 9,
142
- UNSUBSCRIBE = 10,
143
- UNSUB_ACK = 11,
144
- PING_REQ = 12,
145
- PING_RESP = 13,
146
- /** 连接挂断 */
147
- DISCONNECT = 14,
148
- RESERVER2 = 15
149
- }
150
- /**
151
- * connect 版本号,用于区分 ConnAckMessage 的解析规则
152
- */
153
- declare enum ConnAckProtocolVer {
154
- /**
155
- * V4 说明:
156
- * ```
157
- * 增加 flag 来标识每个位置是否有内容,如果没有 messageId 说明此 APP 没有配置防重放,默认取0
158
- * status | 4byte
159
- * flag | 1byte 每一位标识是否有对应值,由低到高
160
- * userId | 可变长
161
- * sessionId | 可变长
162
- * timestamp | 8byte
163
- * messageId | 4byte
164
- * onlineClientInfo | 可变长
165
- * ===
166
- * flag 描述:
167
- * | | | | 4 | 3 | 2 | 1 | 0 |
168
- * | | | | hasOnlineClientInfo | hasMessageId | hasTimeStamp | hasSessionId | hasUserId |
169
- * ```
170
- */
171
- V4 = 4,
172
- /**
173
- * V3 说明:
174
- * ```
175
- * status | 4byte
176
- * userId | 可变长
177
- * sessionId | 可变长
178
- * timestamp | 8byte
179
- * descyptionType | 1byte
180
- * secretKey | 可变长
181
- * onlineClientInfo | 可变长
182
- * ```
183
- */
184
- V3 = 3
185
- }
186
-
187
- /**
188
- * @todo 注释补全
189
- * @description
190
- * Header 处理
191
- */
192
- declare class Header {
193
- readonly type: OperationType;
194
- private readonly _retain;
195
- qos: QOS;
196
- private readonly _dup;
197
- readonly syncMsg: boolean;
198
- constructor(type: OperationType, retain?: boolean, qos?: QOS, dup?: boolean);
199
- encode(): number;
200
- }
201
- /**
202
- * @description
203
- * 融云读取二进制数据
204
- */
205
- declare class RongStreamReader {
206
- private _pool;
207
- private _position;
208
- private _poolLen;
209
- constructor(arr: Uint8Array);
210
- check(): boolean;
211
- /**
212
- * 读 2 位
213
- */
214
- read2Byte(): number;
215
- /**
216
- * 读 4 位
217
- */
218
- readInt(): number;
219
- /**
220
- * 读 8 位
221
- */
222
- readLong(): number;
223
- /**
224
- * 读 1 位
225
- */
226
- readByte(): number;
227
- /**
228
- * 获取数据
229
- */
230
- readUTF(): string;
231
- /**
232
- * 读剩余的所有值
233
- */
234
- readAll(): Uint8Array;
235
- }
236
- /**
237
- * @description
238
- * 融云写入二进制数据
239
- */
240
- declare class RongStreamWriter {
241
- private _pool;
242
- private _position;
243
- private _writen;
244
- /**
245
- * 写入缓存区, writen 值往后移
246
- */
247
- write(byte: number): number;
248
- writeArr(byte: Array<number>): number[];
249
- writeUTF(str: string): void;
250
- getBytesArray(): Array<number>;
251
- }
252
-
253
105
  /**
254
106
  * LogLevel 等级定义,与大数据服务器日志等级保持一致
255
107
  */
@@ -570,7 +422,7 @@ declare enum ErrorCode {
570
422
  */
571
423
  FORBIDDEN_IN_CHATROOM = 23408,
572
424
  /**
573
- * 聊天室中成员被踢出
425
+ * 当前用户被目标聊天室封禁
574
426
  */
575
427
  RC_CHATROOM_USER_KICKED = 23409,
576
428
  /**
@@ -663,9 +515,9 @@ declare enum ErrorCode {
663
515
  */
664
516
  RC_HTTP_RECV_FAIL = 30006,
665
517
  /**
666
- * 导航操作的 HTTP 请求,返回不是200。
518
+ * 导航请求失败
667
519
  */
668
- RC_NAVI_RESOURCE_ERROR = 30007,
520
+ RC_NAVI_REQ_FAILED = 30007,
669
521
  /**
670
522
  * 导航数据解析后,其中不存在有效数据。
671
523
  */
@@ -675,21 +527,17 @@ declare enum ErrorCode {
675
527
  */
676
528
  RC_DOMAIN_NOT_RESOLVE = 30009,
677
529
  /**
678
- * 创建 Socket 失败。
530
+ * Socket 连接失败
679
531
  */
680
532
  RC_SOCKET_NOT_CREATED = 30010,
681
533
  /**
682
- * Socket 被断开。
534
+ * Socket 连接断开
683
535
  */
684
536
  RC_SOCKET_DISCONNECTED = 30011,
685
537
  /**
686
- * PING 操作失败。
687
- */
688
- RC_PING_SEND_FAIL = 30012,
689
- /**
690
- * PING 超时。
538
+ * PING 连续失败次数超限制
691
539
  */
692
- RC_PONG_RECV_FAIL = 30013,
540
+ RC_PING_EXCEED_LIMIT = 30012,
693
541
  /**
694
542
  * 消息发送失败。
695
543
  */
@@ -699,27 +547,27 @@ declare enum ErrorCode {
699
547
  */
700
548
  RC_MSG_CONTENT_EXCEED_LIMIT = 30016,
701
549
  /**
702
- * connect 连接时,收到的 ACK 超时。
550
+ * TCP 连接中,CMP 应答超时。
703
551
  */
704
552
  RC_CONN_ACK_TIMEOUT = 31000,
705
553
  /**
706
- * 参数错误。
554
+ * 连接协议版本错误
707
555
  */
708
556
  RC_CONN_PROTO_VERSION_ERROR = 31001,
709
557
  /**
710
- * 参数错误,App Id 错误。
558
+ * 客户端连接用设备 info 信息错误
711
559
  */
712
- RC_CONN_ID_REJECT = 31002,
560
+ RC_CONN_IDENTIFIER_REJECTED = 31002,
713
561
  /**
714
- * 服务器不可用。
562
+ * 连接服务未开通,需要排查后台小程序(或桌面端)服务是否已开通
715
563
  */
716
564
  RC_CONN_SERVER_UNAVAILABLE = 31003,
717
565
  /**
718
- * Token 错误。
566
+ * Token 无法解析,或 Token 已过期
719
567
  */
720
- RC_CONN_USER_OR_PASSWD_ERROR = 31004,
568
+ RC_CONN_TOKEN_INCORRECT = 31004,
721
569
  /**
722
- * websocket 鉴权失败,通常为连接后未及时发送 Ping 或接收到 Pong
570
+ * 防黑产校验失败
723
571
  */
724
572
  RC_CONN_NOT_AUTHRORIZED = 31005,
725
573
  /**
@@ -727,31 +575,51 @@ declare enum ErrorCode {
727
575
  */
728
576
  RC_CONN_REDIRECTED = 31006,
729
577
  /**
730
- * NAME 与后台注册信息不一致。
578
+ * 包名不合法(目前仅限移动端使用)
731
579
  */
732
580
  RC_CONN_PACKAGE_NAME_INVALID = 31007,
733
581
  /**
734
- * APP 被屏蔽、删除或不存在。
582
+ * Appkey 已被封禁或删除
735
583
  */
736
584
  RC_CONN_APP_BLOCKED_OR_DELETED = 31008,
737
585
  /**
738
- * 用户被屏蔽。
586
+ * 用户已被封禁
739
587
  */
740
588
  RC_CONN_USER_BLOCKED = 31009,
741
589
  /**
742
- * Disconnect,由服务器返回,比如用户互踢。
590
+ * 其他端登录导致本端被踢
743
591
  */
744
592
  RC_DISCONN_KICK = 31010,
745
593
  /**
746
- * Disconnect,由服务器返回,比如用户互踢。
594
+ * 用户在线时被封禁导致连接断开
747
595
  */
748
596
  RC_DISCONN_EXCEPTION = 31011,
749
597
  /**
750
- * 开启禁止把已在线客户端踢下线开关后,该错误码标识已有同类型端在线,禁止链接;
598
+ * Token 已过期
599
+ */
600
+ RC_CONN_TOKEN_EXPIRED = 31020,
601
+ /**
602
+ * Token 中携带 deviceId 时,检测 Token 中 deviceId 与链接设备 deviceId 不一致
603
+ */
604
+ RC_CONN_DEVICE_ERROR = 31021,
605
+ /**
606
+ * 页面域名不在安全域名白名单内,需通过开发者后台添加安全域名配置
607
+ */
608
+ RC_CONN_HOSTNAME_ERROR = 31022,
609
+ /**
610
+ * 开启禁止把已在线客户端踢下线开关后,该错误码标识已有同类型端在线
751
611
  */
752
612
  RC_DISCONN_SAME_CLIENT_ON_LINE = 31023,
753
613
  /**
754
- * app 验证Token 验证不通过。所有内部超时,访问失败,返回给客户端sdk都是验证不通过,由服务端日志去看具体是那种失败。
614
+ * 连接数已达上限(私有云)
615
+ */
616
+ RC_LISCENSE_COUNT_OUT_OF_LIMIT = 31024,
617
+ /**
618
+ * 客户端连错环境,引发连接拒绝;如使用开发环境 Appkey 连接到生产环境
619
+ */
620
+ RC_CONN_WRONG_CLUSTER = 31025,
621
+ /**
622
+ * 开启 AppServer 联合鉴权功能后,到 AppServer 认证失败
755
623
  */
756
624
  RC_APP_AUTH_NOT_PASS = 31026,
757
625
  /**
@@ -759,16 +627,15 @@ declare enum ErrorCode {
759
627
  */
760
628
  RC_OTP_USED = 31027,
761
629
  /**
762
- * token平台验证失败
630
+ * Token 绑定的平台与登录平台不符
763
631
  */
764
632
  RC_PLATFORM_ERROR = 31028,
765
633
  /**
766
634
  * 用户账号已销户
767
- * @desc 请检查您使用的 Token 是否正确,以及对应的 UserId 是否被销户
768
635
  */
769
- RC_CONN_USER_LOGOUT = 31029,
636
+ RC_ACCOUNT_CANCELLATION = 31029,
770
637
  /**
771
- * 证书过期,SDK不会重连
638
+ * License 授权过期(私有云)
772
639
  */
773
640
  RC_LICENSE_EXPIRED = 31030,
774
641
  /**
@@ -779,6 +646,10 @@ declare enum ErrorCode {
779
646
  * 协议层内部错误。
780
647
  */
781
648
  RC_MSG_DATA_INCOMPLETE = 32002,
649
+ /**
650
+ * TCP 连接重置
651
+ */
652
+ RC_TCP_RESET = 32054,
782
653
  /**
783
654
  * 未调用 init 初始化函数。
784
655
  */
@@ -888,7 +759,7 @@ declare enum ErrorCode {
888
759
  */
889
760
  CAN_NOT_RECONNECT = 35007,
890
761
  /**
891
- * 不支持的平台类型,一般小程序或 PC 未开通
762
+ * 无可用的 IM 服务地址
892
763
  */
893
764
  SERVER_UNAVAILABLE = 35008,
894
765
  /**
@@ -1058,11 +929,34 @@ declare enum ErrorCode {
1058
929
  * 聊天室设置批量kv,一次不能超过10个
1059
930
  */
1060
931
  CHATROOM_KV_STORE_OUT_LIMIT = 23429,
1061
- SEARCH_PROPS_LIMIT_ERROR = 35022
932
+ SEARCH_PROPS_LIMIT_ERROR = 35022,
933
+ /**
934
+ * 非法的代理配置,RongIMProxy 为空或者非法
935
+ */
936
+ INVALID_PARAMETER_PROXY = 34238,
937
+ /**
938
+ * 代理测试服务地址为空或者非法
939
+ */
940
+ INVALID_PARAMETER_TESTHOST = 34239,
941
+ /**
942
+ * 开发者接口调用 testProxy 接口时无法联通
943
+ */
944
+ INVALID_CONNECT_TESTHOST_FAILED = 34240,
945
+ /**
946
+ * 开发者调用 connect 时 proxy 服务设置失败
947
+ * 移动端使用的为 31028,但web 端此状态码已经被占用,所以改为 web 端使用号码段 35XXX
948
+ * @discussion 设置 setProxy 接口不可在连接或正在连接中的状态调用。
949
+ */
950
+ RC_CONN_PROXY_UNAVAILABLE = 35028,
951
+ /**
952
+ * proxy 服务不可用
953
+ */
954
+ PROXY_UNAVAILABLE = 17
1062
955
  }
1063
956
 
1064
957
  /**
1065
958
  * 连接状态
959
+ * @deprecated 请使用 `RCConnectionStatus` 替代此枚举声明
1066
960
  */
1067
961
  declare enum ConnectionStatus {
1068
962
  /**
@@ -1148,7 +1042,11 @@ declare enum ConnectionStatus {
1148
1042
  /**
1149
1043
  * 证书过期,SDK不会重连
1150
1044
  */
1151
- RC_LICENSE_EXPIRED = 31030
1045
+ RC_LICENSE_EXPIRED = 31030,
1046
+ /**
1047
+ * Token 错误。
1048
+ */
1049
+ RC_CONN_USER_OR_PASSWD_ERROR = 31004
1152
1050
  }
1153
1051
 
1154
1052
  /**
@@ -1178,92 +1076,6 @@ declare enum ReceivedStatus {
1178
1076
  UNREAD = 0
1179
1077
  }
1180
1078
 
1181
- /**
1182
- * CMP/Comet 服务连接应答码
1183
- */
1184
- declare const ConnectResultCode: {
1185
- /**
1186
- * 连接成功
1187
- */
1188
- ACCEPTED: number;
1189
- /**
1190
- * 协议版本不匹配
1191
- * @description 暂未使用
1192
- */
1193
- UNACCEPTABLE_PROTOCOL_VERSION: number;
1194
- /**
1195
- * 客户端(移动端 TCP 连接建立时)`info` 字段格式错误
1196
- * @description 格式:`{平台类型}-{设备信息}-{sdk版本}`。
1197
- * 其中设备信息为:{手机类型}{手机型号}{网络类型,4G/WIFI}{运营商标识, 移动/电信/联通}
1198
- */
1199
- IDENTIFIER_REJECTED: number;
1200
- /**
1201
- * 不支持的平台类型,一般小程序或 PC 未开通
1202
- */
1203
- SERVER_UNAVAILABLE: number;
1204
- /**
1205
- * Token无法解析,或Token已过期
1206
- */
1207
- TOKEN_INCORRECT: number;
1208
- /**
1209
- * 防黑产规则相关应答
1210
- */
1211
- NOT_AUTHORIZED: number;
1212
- /**
1213
- * 服务重定向,一般服务扩缩容时,落点已经改变,此时 userId 链接到旧的节点时,会触发该错误。
1214
- * 客户端收到该应答后须重新访问导航,重新获取 CMP 地址
1215
- */
1216
- REDIRECT: number;
1217
- /**
1218
- * 暂未使用
1219
- */
1220
- PACKAGE_ERROR: number;
1221
- /**
1222
- * 该 AppKey 已经封禁或删除
1223
- */
1224
- APP_BLOCK_OR_DELETE: number;
1225
- /**
1226
- * 该用户 ID 已经被封禁
1227
- */
1228
- BLOCK: number;
1229
- /**
1230
- * Token 已过期,暂未使用
1231
- */
1232
- TOKEN_EXPIRE: number;
1233
- /**
1234
- * Token 中携带 deviceId 时,检测 Token 中 deviceId 与链接设备 deviceId 不一致
1235
- */
1236
- DEVICE_ERROR: number;
1237
- /**
1238
- * Web 端设置安全域名后,连接端域名不在安全域名范围内
1239
- */
1240
- HOSTNAME_ERROR: number;
1241
- /**
1242
- * 开启`禁止把已在线客户端踢下线`开关后,该错误码标识已有同类型端在线,禁止链接
1243
- */
1244
- HASOHTERSAMECLIENTONLINE: number;
1245
- /**
1246
- * 客户端连错环境,引发连接拒绝
1247
- */
1248
- IN_OTHER_CLUSTER: number;
1249
- /**
1250
- * app 验证Token 验证不通过。所有内部超时,访问失败,返回给客户端sdk都是验证不通过,由服务端日志去看具体是那种失败。
1251
- */
1252
- APP_AUTH_NOT_PASS: number;
1253
- /**
1254
- * One Time Password 已经被使用过
1255
- */
1256
- OTP_USED: number;
1257
- /**
1258
- * token平台验证失败
1259
- */
1260
- PLATFORM_ERROR: number;
1261
- /**
1262
- * 用户账号已销户,不再进行连接
1263
- */
1264
- USER_LOGOUT: number;
1265
- };
1266
-
1267
1079
  /**
1268
1080
  * 内置消息类型
1269
1081
  */
@@ -1328,6 +1140,14 @@ declare enum MessageType {
1328
1140
  * 撤回消息
1329
1141
  */
1330
1142
  RECALL = "RC:RcCmd",
1143
+ /**
1144
+ * 撤回通知消息
1145
+ *
1146
+ * 融云定义了 ObjectName 为 `RC:RcNtf` 的撤回通知消息
1147
+ *
1148
+ * PC: recallMessage 会替换聊天记录中的原始消息为一条 objectName 为 `RC:RcNtf` 的撤回通知消息
1149
+ */
1150
+ RECALL_NOTIFICATION_MESSAGE = "RC:RcNtf",
1331
1151
  /**
1332
1152
  * 已读同步状态消息
1333
1153
  */
@@ -1515,6 +1335,7 @@ declare enum LogTagId {
1515
1335
  L_DESTROY_O = "L_DESTROY_O",
1516
1336
  A_CONNECT_T = "A-connect-T",
1517
1337
  A_CONNECT_R = "A-connect-R",
1338
+ A_CONNECT_S = "A-connect-S",
1518
1339
  A_DISCONNECT_O = "A-disconnect-O",
1519
1340
  A_RECONNECT_T = "A-reconnect-T",
1520
1341
  A_RECONNECT_R = "A_RECONNECT_R",
@@ -1570,6 +1391,8 @@ declare enum LogTagId {
1570
1391
  P_REGTYP_E = "P-regtype-E",
1571
1392
  L_GET_NAVI_T = "L-get_navi-T",
1572
1393
  L_GET_NAVI_R = "L-get_navi-R",
1394
+ L_GET_NAVI_O = "L-get_navi-O",
1395
+ L_PARSE_NAVI_E = "L-parse_navi-E",
1573
1396
  L_ENV_S = "L-Env-S",
1574
1397
  L_GET_INDEX_NAVI_S = "L-get_index_navi-S",
1575
1398
  A_JOIN_CHATROOM_T = "A-join_chatroom-T",
@@ -1580,6 +1403,7 @@ declare enum LogTagId {
1580
1403
  A_QUIT_CHATROOM_R = "A-quit_chatroom-R",
1581
1404
  L_REJOIN_CHATROOM_T = "L-rejoin_chatroom-T",
1582
1405
  L_REJOIN_CHATROOM_R = "L-rejoin_chatroom-R",
1406
+ L_REJOIN_CHATROOM_S = "L-rejoin_chatroom-S",
1583
1407
  L_MEDIA_S = "L-media-S",
1584
1408
  L_MEDIA_UPLOAD_T = "L-media_upload-T",
1585
1409
  L_MEDIA_UPLOAD_R = "L-media_upload-R",
@@ -1589,13 +1413,17 @@ declare enum LogTagId {
1589
1413
  G_GET_REAL_TIMELOG_COMMAND_S = "G-get_real_timelog_command-S",
1590
1414
  L_CHECK_ALIVE_IM_T = "L-check_alive_im-T",
1591
1415
  L_CHECK_ALIVE_IM_R = "L-check_alive_im-R",
1416
+ L_CHECK_ALIVE_IM_S = "L-check_alive_im-S",
1592
1417
  A_GET_HISTORY_MSG_T = "A-get_history_msg-T",
1593
1418
  A_GET_HISTORY_MSG_R = "A-get_history_msg-R",
1594
1419
  L_GET_HISTORY_MSG_T = "L-get_history_msg-T",
1595
1420
  L_GET_HISTORY_MSG_R = "L-get_history_msg-R",
1421
+ A_GET_PRIVATE_MESSAGE_DELIVER_TIME_E = "A-get_privage_message_deliver_time-E",
1422
+ A_GET_GROUP_MESSAGE_DELIVER_LIST_E = "A-get_group_message_deliver_list-E",
1596
1423
  A_CALLBACK_O = "A-callback-O",
1597
1424
  A_CALLBACK_E = "A-callback-E",
1598
1425
  L_CALLBACK_E = "L-callback-E",
1426
+ A_GET_TOP_CONVERSATION_LIST_E = "A-get_top_conversation_list-E",
1599
1427
  /**
1600
1428
  * PB 数据编码错误
1601
1429
  */
@@ -1629,7 +1457,10 @@ declare enum LogTagId {
1629
1457
  L_CALL_MAIN_SYNC_O = "L_CALL_MAIN_SYNC_O",
1630
1458
  /** 未知的通知 */
1631
1459
  L_UNSUPPORT_NTF_FROM_MAIN_E = "L_UNSUPPORT_NTF_FROM_MAIN_E",
1632
- A_SET_MSG_CONTENT_O = "A_SET_MSG_CONTENT_O"
1460
+ A_SET_MSG_CONTENT_O = "A_SET_MSG_CONTENT_O",
1461
+ A_REMOVE_PROXY_O = "A-remove_proxy-O",
1462
+ A_SET_PROXY_O = "A-set_proxy-O",
1463
+ A_TEST_PROXY_O = "A-test_proxy-O"
1633
1464
  }
1634
1465
 
1635
1466
  /**
@@ -2432,6 +2263,13 @@ interface IUltraUnreadMsg {
2432
2263
  mentionedType?: number;
2433
2264
  }
2434
2265
 
2266
+ interface IMentionInfo {
2267
+ type: MentionedType;
2268
+ /**
2269
+ * 被 @ 的用户 Id 列表,仅在 `type` 为 `2` 时有效
2270
+ */
2271
+ userIdList: string[];
2272
+ }
2435
2273
  /**
2436
2274
  * 从服务器拉取到的会话数据结构
2437
2275
  * @category Interface
@@ -2467,16 +2305,7 @@ interface IReceivedConversation {
2467
2305
  /**
2468
2306
  * 消息中的 @ 数据,仅在 `conversationType` 为 `ConversationType.GROUP` 时有效
2469
2307
  */
2470
- mentionedInfo?: {
2471
- /**
2472
- * `@ 类型,其中 1 为 @ 所有人,2 为 @ 部分人`
2473
- */
2474
- type: 1 | 2;
2475
- /**
2476
- * 被 @ 的用户 Id 列表,仅在 `type` 为 `2` 时有效
2477
- */
2478
- userIdList: string[];
2479
- } | null;
2308
+ mentionedInfo?: IMentionInfo | null;
2480
2309
  /**
2481
2310
  * 会话免打扰状态
2482
2311
  * @description
@@ -2630,742 +2459,855 @@ interface IUltraUnreadConversation {
2630
2459
  }
2631
2460
 
2632
2461
  /**
2633
- * 导航信息数据就结构
2462
+ * @category Interface
2634
2463
  */
2635
- interface INaviInfo {
2464
+ interface IChatroomEntryListenerData {
2636
2465
  /**
2637
- * Navi 数据请求响应码,200 为成功请求
2638
- */
2639
- code: number;
2466
+ * 更新的键
2467
+ */
2468
+ key: string;
2640
2469
  /**
2641
- * 获取 Navi 数据失败时的提示信息
2642
- */
2643
- errorMessage?: string;
2470
+ * 更新的值
2471
+ */
2472
+ value: string;
2644
2473
  /**
2645
- * 获取 Navi 数据失败时的请求 url 信息
2646
- */
2647
- url?: string;
2474
+ * 更新的时间
2475
+ */
2476
+ timestamp: number;
2648
2477
  /**
2649
- * 请求导航数据时使用的协议:http / https
2650
- * @description 该字段为 SDK 内增加的字段,导航接口数据中不存在
2651
- */
2652
- protocol: 'http' | 'https';
2478
+ * 更新的聊天室 ID
2479
+ */
2480
+ chatroomId: string;
2653
2481
  /**
2654
- * 获取导航时使用的 userId,小程序不走导航,故拿不到 userId
2655
- */
2656
- userId?: string;
2482
+ * 更新类型
2483
+ */
2484
+ type: ChatroomEntryType;
2485
+ }
2486
+ /**
2487
+ * @category Interface
2488
+ */
2489
+ interface IChatroomRejoinedFailed {
2657
2490
  /**
2658
- * CMP 服务 Websocket 连接地址,包含域名与端口,不含 ws 或 wss 协议头
2659
- * @example a.domain.com:443
2491
+ * 自动重新加入的聊天室 ID
2492
+ */
2493
+ chatroomId: string;
2494
+ /**
2495
+ * 自动重新加入失败的 code
2496
+ */
2497
+ errorCode: number;
2498
+ }
2499
+ /**
2500
+ * @category Interface
2501
+ */
2502
+ interface IChatroomRejoinedSuccessed {
2503
+ /**
2504
+ * 自动重新加入的聊天室 ID
2505
+ */
2506
+ chatroomId: string;
2507
+ /**
2508
+ * 自动重新加入的聊天室拉取消息的数量
2509
+ */
2510
+ count: number;
2511
+ }
2512
+ /**
2513
+ * @category Interface
2514
+ */
2515
+ interface IChatroomUserChangeInfo {
2516
+ users: {
2517
+ [userId: string]: ChatroomUserChangeType;
2518
+ };
2519
+ chatroomId: string;
2520
+ }
2521
+ declare type IChatroomRejoinedInfo = IChatroomRejoinedFailed | IChatroomRejoinedSuccessed;
2522
+ /**
2523
+ * 聊天室信息
2524
+ * @category Interface
2525
+ */
2526
+ interface IChatroomListenerData {
2527
+ /**
2528
+ * SDK 内部重连聊天室信息
2529
+ */
2530
+ rejoinedRoom?: IChatroomRejoinedInfo;
2531
+ /**
2532
+ * 监听到的聊天室 KV 更新
2533
+ */
2534
+ updatedEntries?: IChatroomEntryListenerData[];
2535
+ /**
2536
+ * 登录退出的用户通知
2660
2537
  */
2661
- server: string;
2538
+ userChange?: IChatroomUserChangeInfo;
2662
2539
  /**
2663
- * 备用 CMP 服务地址,包含域名与端口,不含 ws 或 wss 协议头,多个备用地址以 ',' 分割
2664
- * @example a.domain.com:443,b.domain.com:443
2540
+ * 聊天室销毁
2665
2541
  */
2666
- backupServer?: string;
2542
+ chatroomDestroyed?: string;
2543
+ }
2544
+ /**
2545
+ * @category Interface
2546
+ */
2547
+ interface IChatroomEntry {
2667
2548
  /**
2668
- * 备用 CMP 服务地址,POST 请求 TCP 连接返回的是 bs 字段,非 backupServer 字段
2549
+ * 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2669
2550
  */
2670
- bs?: string;
2551
+ key: string;
2671
2552
  /**
2672
- * RTC 服务配置,其值可能为 null、无效字符串、有效 JSON 字符串
2673
- * 1. 公有云未开通音视频时,值为 null
2674
- * 2. 私有云无配置时为 `{ "strategy": 0 }`
2553
+ * 属性对应的值, 最大长度 4096 字符
2675
2554
  */
2676
- voipCallInfo: string | null;
2555
+ value: string;
2677
2556
  /**
2678
- * 聊天室 kv 存储开关
2679
- * @todo 需确认详细有效值
2680
- * @description 公有云独有配置
2557
+ * 设置成功后是否发送通知消息
2681
2558
  */
2682
- kvStorage: number;
2559
+ isSendNotification?: boolean;
2683
2560
  /**
2684
- * HttpDNS 功能开关,在 web 端无效
2685
- * @description 公有云独有配置
2561
+ * RC:chrmKVNotiMsg 消息中携带的附加信息
2686
2562
  */
2687
- openHttpDNS: boolean;
2563
+ notificationExtra?: string;
2688
2564
  /**
2689
- * 历史消息云存储功能开关
2690
- * @description
2691
- * 1. 公有云通过 `developer.rongcloud.cn` 管理后台 `单群聊消息云端存储` 功能开关进行配置
2692
- * 2. 私有云默认为 `true`
2565
+ * 用户退出聊天室时是否清除此属性
2693
2566
  */
2694
- historyMsg: boolean;
2567
+ isAutoDelete?: boolean;
2568
+ }
2569
+ /**
2570
+ * @category Interface
2571
+ */
2572
+ interface IChatroomUser {
2695
2573
  /**
2696
- * 聊天室历史消息开关
2697
- * @description
2698
- * 1. 私有云对聊天室功能支持有限,默认为 `false`
2699
- * 2. TODO: 公有云配置待确认
2574
+ * 用户 id
2700
2575
  */
2701
- chatroomMsg: boolean;
2576
+ id: string;
2702
2577
  /**
2703
- * 文件服务器地址
2704
- * @description
2705
- * 1. 公有云下,该地址为七牛云服务器地址
2706
- * 2. 私有云下,该地址为私有云自研文件服务器地址
2578
+ * 加入聊天室的时间
2707
2579
  */
2708
- uploadServer: string;
2580
+ time: number;
2581
+ }
2582
+ /**
2583
+ * @category Interface
2584
+ */
2585
+ interface IChatroomInfo {
2709
2586
  /**
2710
- * 实时位置共享配置,web 端无需处理
2587
+ * 成员列表
2588
+ * @todo 需确认数组元素的数据结构
2711
2589
  */
2712
- location: null | string;
2590
+ userInfos: IChatroomUser[];
2713
2591
  /**
2714
- * 实时日志上传开关
2715
- * @todo 需确认有效值及作用
2592
+ * 房间内总人数
2716
2593
  */
2717
- monitor: number;
2594
+ userCount: number;
2595
+ }
2596
+ /**
2597
+ * @category Interface
2598
+ */
2599
+ interface IRemoveChatroomEntry {
2718
2600
  /**
2719
- * 是否允许加入多聊天室开关
2601
+ * 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2720
2602
  */
2721
- joinMChrm: boolean;
2603
+ key: string;
2722
2604
  /**
2723
- * 是否开启公众号功能:`0` 为未开启,`1` 为已开启
2605
+ * 删除成功后是否发送通知消息
2724
2606
  */
2725
- openMp: 0 | 1;
2607
+ isSendNotification?: boolean;
2726
2608
  /**
2727
- * 是否开启用户级配置,若开启,需连接成功后立即拉取实时配置,0 | 1
2728
- * @description
2729
- * 配置来源:
2730
- * 1. 导航
2731
- * 2. 服务端实时下发
2732
- * 已有配置字段:
2733
- * 1. Lan. 推送使用的语言设置,用户端可自定义修改. Web 端未做设置, 只做接收
2734
- * 2. ShPushSwit. 推送是否显示详情设置,用户端可自定义修改. Web 端未做设置, 只做接收
2735
- * 3. MobPushSwit: Web/PC 在线,移动端不在线是否发送推送开关,用户端可自定义修改. Web 端未做设置, 只做接收
2736
- * 4. OffMsgDur: 离线消息保存天数,设置天数不可大于App级对应配置,用户端可自定义修改. Web 端未做设置, 只做接收
2737
- * 5. VoipInfo: 音视频相关配置,用户端不可自定义修改. 由服务端决定,与导航下发格式一致
2738
- * @todo 需确认公有云与私有云区别
2609
+ * RC:chrmKVNotiMsg 消息中携带的附加信息
2739
2610
  */
2740
- openUS: 0 | 1;
2611
+ notificationExtra?: string;
2612
+ }
2613
+ /**
2614
+ * @category Interface
2615
+ */
2616
+ interface IRemoveChatroomEntries {
2741
2617
  /**
2742
- * 超级群功能开关,1表示开
2618
+ * key 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2743
2619
  */
2744
- ugMsg?: 0 | 1;
2620
+ entries: {
2621
+ key: string;
2622
+ }[];
2745
2623
  /**
2746
- * 群离线消息最大下发条数,`0` 为关闭
2747
- * @description 公有云独有配合
2624
+ * 删除成功后是否发送通知消息
2748
2625
  */
2749
- grpMsgLimit: number;
2750
2626
  /**
2751
- * 消息加密开关,0 为关闭
2752
- * @todo
2753
- * 1. 确定其控制的功能
2754
- * 2. 确定 web 相关性
2627
+ * RC:chrmKVNotiMsg 消息中携带的附加信息
2755
2628
  */
2756
- isFormatted: number;
2629
+ notificationExtra?: string;
2630
+ }
2631
+ /**
2632
+ * @category Interface
2633
+ */
2634
+ interface IChatroomEntries {
2757
2635
  /**
2758
- * GIF 动图大小限制,默认 2048 KB
2636
+ * entries ,要设置的属性列表
2637
+ * key 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2638
+ * value 属性对应的值, 最大长度 4096 字符
2759
2639
  */
2760
- gifSize: number;
2640
+ entries: {
2641
+ key: string;
2642
+ value: string;
2643
+ }[];
2761
2644
  /**
2762
- * 上传小视频时长限制,单位:秒
2763
- * @description 公有云字段,即私有云配置中的 `uploadVideoTimeLimit`
2645
+ * 设置成功后是否发送通知消息
2764
2646
  */
2765
- videoTimes?: number;
2766
2647
  /**
2767
- * 上传小视频时长限制,单位:秒
2768
- * @description 私有云字段,即公有云配置中的 `videoTimes`
2648
+ * RC:chrmKVNotiMsg 消息中携带的附加信息
2769
2649
  */
2770
- uploadVideoTimeLimit?: number;
2650
+ notificationExtra?: string;
2771
2651
  /**
2772
- * 实时日志上传开关:`0` 为关闭,`1` 为开启
2652
+ * 用户退出聊天室时是否清除此属性
2773
2653
  */
2774
- logSwitch: number;
2654
+ isAutoDelete?: boolean;
2775
2655
  /**
2776
- * 实时日志上传策略,值为 JSON 字符串
2777
- * @example `'{
2778
- * "url": "logcollection.ronghub.com", // 上传地址
2779
- * "level": 1, // 日志等级
2780
- * "itv": 6, // 上传频率,即时间间隔,单位 s
2781
- * "times": 5 // 重试次数?
2782
- * }'`
2656
+ * 是否强制覆盖
2783
2657
  */
2784
- logPolicy: string;
2658
+ isForce?: boolean;
2659
+ }
2660
+
2661
+ /**
2662
+ * @category Interface
2663
+ */
2664
+ interface IUploadAuth {
2785
2665
  /**
2786
- * 百度 BOS 存储服务地址
2787
- * @description 公有云独有配置
2788
- * @example `gz.bcebos.com`
2789
- */
2790
- bosAddr?: string;
2666
+ * 七牛 token 有效期
2667
+ */
2668
+ deadline: number;
2791
2669
  /**
2792
- * 阿里上传配置,字符串数组,数组顺序代表 七牛、百度、阿里云 上传权重
2793
- * @example
2794
- * ```
2795
- * `[{"qiniu":"upload.qiniup.com","p":"1"},
2796
- * {"baidu":"gz.bcebos.com","p":"2"},
2797
- * {"aliyun":"oss-cn-beijing.aliyuncs.com","p":"3"}]`
2798
- * ```
2670
+ * 七牛上传 token
2671
+ */
2672
+ token: string;
2673
+ /**
2674
+ * 百度上传 token
2675
+ */
2676
+ bosToken: string;
2677
+ /**
2678
+ * 百度上传 header Date
2679
+ */
2680
+ bosDate: string;
2681
+ /**
2682
+ * 百度上传路径
2683
+ */
2684
+ path: string;
2685
+ /**
2686
+ * 上传文件名,阿里上传获取下载地址时,必须使用上传文件名,所以需抛出到业务端
2799
2687
  */
2800
- ossConfig?: string;
2688
+ fileName: string;
2801
2689
  /**
2802
- * 私有云专有属性,可用来判断当前环境是公有云还是私有云,私有云环境下该值为 `1`
2690
+ * 阿里云 oss 的 AccessKeyId
2803
2691
  */
2804
- type?: number;
2692
+ osskeyId: string;
2805
2693
  /**
2806
- * @deprecated 已废弃
2694
+ * 阿里云 oss post 请求表单域中的字段 policy
2807
2695
  */
2808
- compDays: number;
2696
+ ossPolicy: string;
2809
2697
  /**
2810
- * @deprecated 已废弃
2698
+ * 阿里云 oss 根据 policy 计算的签名信息
2811
2699
  */
2812
- msgAck: unknown;
2700
+ ossSign: string;
2813
2701
  /**
2814
- * @deprecated 已废弃
2702
+ * 阿里云 oss 存储空间名称
2815
2703
  */
2816
- activeServer: string;
2704
+ ossBucketName: string;
2817
2705
  /**
2818
- * @deprecated 已废弃
2706
+ * s3 认证凭证,对应 post上传 x-amz-credential 字段
2819
2707
  */
2820
- qnAddr: string;
2708
+ s3Credential: string;
2821
2709
  /**
2822
- * @deprecated 已废弃
2710
+ * 加密算法,对应 post上传 x-amz-algorithm 字段
2823
2711
  */
2824
- extkitSwitch: number;
2712
+ s3Algorithm: string;
2825
2713
  /**
2826
- * @deprecated 已废弃
2714
+ * s3 日期,对应 post上传 x-amz-date 字段
2827
2715
  */
2828
- alone: boolean;
2716
+ s3Date: string;
2829
2717
  /**
2830
- * @deprecated 已废弃
2718
+ * s3 policy,对应 post上传 policy 字段
2831
2719
  */
2832
- voipServer: string;
2720
+ s3Policy: string;
2833
2721
  /**
2834
- * 离线日志上报地址
2835
- * @deprecated 已废弃
2722
+ * s3 签名信息,对应 post上传 x-amz-signature 字段
2836
2723
  */
2837
- offlinelogserver: string;
2724
+ s3Signature: string;
2838
2725
  /**
2839
- * 在线日志上报地址
2840
- * @deprecated 已废弃
2726
+ * s3 存储空间名称
2841
2727
  */
2842
- onlinelogserver?: string;
2728
+ s3BucketName: string;
2843
2729
  /**
2844
- * 链路加密字段,内容为 JSON 字符串,仅限 C++ 可用
2730
+ * stc Authorization
2845
2731
  */
2846
- crypto?: string;
2732
+ stcAuthorization: string;
2847
2733
  /**
2848
- * 群组回执开关, 1: 打开,0(或者没有): 关闭
2734
+ * stc xAmzContentSha256
2849
2735
  */
2850
- grpRRVer?: number;
2736
+ stcContentSha256: string;
2851
2737
  /**
2852
- * 防黑产开关, 1: 打开,0:关闭
2738
+ * stc date
2853
2739
  */
2854
- openAnti?: number;
2740
+ stcDate: string;
2855
2741
  /**
2856
- * 鉴权认证
2742
+ * stc 存储空间名称
2857
2743
  */
2858
- jwt?: string;
2744
+ stcBucketName: string;
2859
2745
  }
2860
2746
 
2861
- /**
2862
- * @category Interface
2863
- */
2864
- interface IChatroomEntryListenerData {
2865
- /**
2866
- * 更新的键
2867
- */
2868
- key: string;
2869
- /**
2870
- * 更新的值
2871
- */
2872
- value: string;
2873
- /**
2874
- * 更新的时间
2875
- */
2876
- timestamp: number;
2877
- /**
2878
- * 更新的聊天室 ID
2879
- */
2880
- chatroomId: string;
2881
- /**
2882
- * 更新类型
2883
- */
2884
- type: ChatroomEntryType;
2747
+ interface IRTCRoomInfo {
2748
+ roomId: string;
2749
+ roomData: unknown[];
2750
+ userCount: number;
2751
+ list: unknown[];
2885
2752
  }
2886
- /**
2887
- * @category Interface
2888
- */
2889
- interface IChatroomRejoinedFailed {
2890
- /**
2891
- * 自动重新加入的聊天室 ID
2892
- */
2893
- chatroomId: string;
2894
- /**
2895
- * 自动重新加入失败的 code
2896
- */
2897
- errorCode: number;
2753
+ interface IRtcTokenData {
2754
+ rtcToken: string;
2898
2755
  }
2899
- /**
2900
- * @category Interface
2901
- */
2902
- interface IChatroomRejoinedSuccessed {
2903
- /**
2904
- * 自动重新加入的聊天室 ID
2905
- */
2906
- chatroomId: string;
2907
- /**
2908
- * 自动重新加入的聊天室拉取消息的数量
2909
- */
2910
- count: number;
2756
+ interface IRTCUsers {
2757
+ users: {
2758
+ [userId: string]: {
2759
+ /**
2760
+ * 发布的资源数据,是一个 JSON 字符串,解析后为发布的资源列表
2761
+ */
2762
+ uris?: string;
2763
+ /**
2764
+ * 加房间的身份标识,保存主房间 roomId
2765
+ */
2766
+ extra?: string;
2767
+ };
2768
+ };
2769
+ }
2770
+ interface IJoinRTCRoomData extends IRTCUsers {
2771
+ token: string;
2772
+ sessionId: string;
2773
+ roomInfo: {
2774
+ key: string;
2775
+ value: string;
2776
+ }[];
2777
+ kvEntries: IServerRTCRoomEntry[];
2778
+ offlineKickTime: number;
2779
+ }
2780
+ interface KVString {
2781
+ [key: string]: string;
2911
2782
  }
2912
2783
  /**
2913
- * @category Interface
2784
+ * 设置 RTC 人员 inner、outer 数据
2914
2785
  */
2915
- interface IChatroomUserChangeInfo {
2916
- users: {
2917
- [userId: string]: ChatroomUserChangeType;
2918
- };
2919
- chatroomId: string;
2786
+ interface IRTCUserData {
2787
+ [key: string]: string;
2920
2788
  }
2921
- declare type IChatroomRejoinedInfo = IChatroomRejoinedFailed | IChatroomRejoinedSuccessed;
2789
+
2922
2790
  /**
2923
- * 聊天室信息
2924
2791
  * @category Interface
2925
- */
2926
- interface IChatroomListenerData {
2792
+ */
2793
+ interface IAsyncRes<T = void> {
2927
2794
  /**
2928
- * SDK 内部重连聊天室信息
2929
- */
2930
- rejoinedRoom?: IChatroomRejoinedInfo;
2795
+ * Promise 执行结果
2796
+ */
2797
+ code: ErrorCode;
2931
2798
  /**
2932
- * 监听到的聊天室 KV 更新
2933
- */
2934
- updatedEntries?: IChatroomEntryListenerData[];
2799
+ * 结果数据
2800
+ */
2801
+ data?: T;
2935
2802
  /**
2936
- * 登录退出的用户通知
2803
+ * 错误消息
2937
2804
  */
2938
- userChange?: IChatroomUserChangeInfo;
2805
+ msg?: string;
2806
+ }
2807
+ /**
2808
+ * 异步任务结果定义
2809
+ * @description
2810
+ * 通过 `Promise.resolve` 来处理预期内的异常,进而通过 Uncatch Promise Error 暴露预期外的异常
2811
+ */
2812
+ declare type IPromiseResult<T = void> = Promise<IAsyncRes<T>>;
2813
+ interface IConnectResult {
2939
2814
  /**
2940
- * 聊天室销毁
2815
+ * 连接错误码
2941
2816
  */
2942
- chatroomDestroyed?: string;
2817
+ code: ErrorCode;
2818
+ /**
2819
+ * 导航获取成功后即可有相应的值,在导航数据获取完成之前该值为 undefined
2820
+ */
2821
+ userId?: string;
2943
2822
  }
2823
+
2944
2824
  /**
2945
- * @category Interface
2825
+ * 代理信息
2946
2826
  */
2947
- interface IChatroomEntry {
2827
+ interface IProxy {
2828
+ socksHost: string;
2829
+ socksPort: number;
2830
+ socksUsername?: string;
2831
+ socksPassword?: string;
2832
+ }
2833
+
2834
+ declare enum HttpMethod {
2835
+ GET = "GET",
2836
+ POST = "POST"
2837
+ }
2838
+ interface IRequest {
2839
+ url: string;
2948
2840
  /**
2949
- * 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2841
+ * @default `HttpMethod.GET`
2950
2842
  */
2951
- key: string;
2843
+ method?: HttpMethod | 'GET' | 'POST';
2952
2844
  /**
2953
- * 属性对应的值, 最大长度 4096 字符
2845
+ * 查询数据
2954
2846
  */
2955
- value: string;
2847
+ query?: {
2848
+ [key: string]: string | number | null;
2849
+ };
2956
2850
  /**
2957
- * 设置成功后是否发送通知消息
2851
+ * Request Header 信息
2958
2852
  */
2959
- isSendNotification?: boolean;
2853
+ headers?: {
2854
+ [key: string]: string;
2855
+ };
2960
2856
  /**
2961
- * RC:chrmKVNotiMsg 消息中携带的附加信息
2857
+ * Request Body 数据
2962
2858
  */
2963
- notificationExtra?: string;
2859
+ body?: Object | string;
2964
2860
  /**
2965
- * 用户退出聊天室时是否清除此属性
2861
+ * 超时设置,默认 `60s`
2966
2862
  */
2967
- isAutoDelete?: boolean;
2968
- }
2969
- /**
2970
- * @category Interface
2971
- */
2972
- interface IChatroomUser {
2863
+ timeout?: number;
2973
2864
  /**
2974
- * 用户 id
2865
+ * 【Alipay-Only】
2866
+ * 期望返回的数据格式,如果为 json 则返回后会对返回的数据进行一次 JSON.parse
2975
2867
  */
2976
- id: string;
2868
+ dataType?: 'json' | 'text' | 'base64' | 'arraybuffer';
2977
2869
  /**
2978
- * 加入聊天室的时间
2870
+ * socks5 代理参数,仅 Electron 平台有效,web 平台默认为 null
2979
2871
  */
2980
- time: number;
2872
+ proxy?: IProxy | null;
2873
+ }
2874
+ interface IStorage {
2875
+ setItem(key: string, value: string): void;
2876
+ getItem(key: string): string | null;
2877
+ removeItem(key: string): void;
2878
+ clear(): void;
2879
+ }
2880
+ interface IResponse {
2881
+ status: number;
2882
+ data?: string;
2981
2883
  }
2982
2884
  /**
2983
- * @category Interface
2885
+ * 网络状态枚举
2984
2886
  */
2985
- interface IChatroomInfo {
2887
+ declare enum NetworkType {
2888
+ WIFI = "wifi",
2889
+ FOUR_G = "4g",
2890
+ THREE_G = "3g",
2891
+ TWO_G = "2g",
2892
+ FIVE_G = "2g",
2893
+ THREE_GENT = "3gnet",
2894
+ UNKONWN = "unknown"
2895
+ }
2896
+ interface IWebSocket {
2986
2897
  /**
2987
- * 成员列表
2988
- * @todo 需确认数组元素的数据结构
2898
+ * 监听连接建立事件,此时 WebSocket 实例已准备好收发数据
2899
+ * @param callback
2989
2900
  */
2990
- userInfos: IChatroomUser[];
2901
+ onOpen(callback: () => void): void;
2991
2902
  /**
2992
- * 房间内总人数
2903
+ * 监听连接关闭事件
2904
+ * @param callback
2993
2905
  */
2994
- userCount: number;
2995
- }
2996
- /**
2997
- * @category Interface
2998
- */
2999
- interface IRemoveChatroomEntry {
2906
+ onClose(callback: (code?: number, reason?: string) => void): void;
3000
2907
  /**
3001
- * 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2908
+ * 监听接收服务器消息事件
2909
+ * @param callback
3002
2910
  */
3003
- key: string;
2911
+ onMessage(callback: (data: string | ArrayBuffer) => void): void;
3004
2912
  /**
3005
- * 删除成功后是否发送通知消息
2913
+ * 监听链接错误事件
2914
+ * @param callback
3006
2915
  */
3007
- isSendNotification?: boolean;
2916
+ onError(callback: (error: unknown) => void): void;
3008
2917
  /**
3009
- * RC:chrmKVNotiMsg 消息中携带的附加信息
2918
+ * 向服务器发送数据
2919
+ * @param data
3010
2920
  */
3011
- notificationExtra?: string;
2921
+ send(data: ArrayBuffer | string): void;
2922
+ /**
2923
+ * 关闭连接
2924
+ * @param code
2925
+ * @param reason
2926
+ */
2927
+ close(code?: number, reason?: string): void;
3012
2928
  }
3013
2929
  /**
3014
- * @category Interface
2930
+ * 平台运行时抽象
3015
2931
  */
3016
- interface IRemoveChatroomEntries {
2932
+ interface IRuntime {
3017
2933
  /**
3018
- * key 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
2934
+ * 平台标识
3019
2935
  */
3020
- entries: {
3021
- key: string;
3022
- }[];
2936
+ tag: string;
3023
2937
  /**
3024
- * 删除成功后是否发送通知消息
2938
+ * 发送 http 请求
2939
+ * @param options
3025
2940
  */
2941
+ httpReq(options: IRequest): Promise<IResponse>;
3026
2942
  /**
3027
- * RC:chrmKVNotiMsg 消息中携带的附加信息
2943
+ * 是否使用导航
3028
2944
  */
3029
- notificationExtra?: string;
3030
- }
3031
- /**
3032
- * @category Interface
3033
- */
3034
- interface IChatroomEntries {
2945
+ useNavi: boolean;
3035
2946
  /**
3036
- * entries ,要设置的属性列表
3037
- * key 属性名称, 支持英文字母、数字、+、=、-、_ 的组合方式, 最大长度 128 字符
3038
- * value 属性对应的值, 最大长度 4096 字符
2947
+ * websocket 地址上附加的平台字段
3039
2948
  */
3040
- entries: {
3041
- key: string;
3042
- value: string;
3043
- }[];
2949
+ connectPlatform: string;
3044
2950
  /**
3045
- * 设置成功后是否发送通知消息
2951
+ * websocket 地址上 apiVer 字段,代表代码是否来源于 uniapp
3046
2952
  */
2953
+ isFromUniapp: boolean;
3047
2954
  /**
3048
- * RC:chrmKVNotiMsg 消息中携带的附加信息
2955
+ * 创建长连接实例
3049
2956
  */
3050
- notificationExtra?: string;
2957
+ createWebSocket(url: string, protocols?: string[]): IWebSocket;
3051
2958
  /**
3052
- * 用户退出聊天室时是否清除此属性
2959
+ * 存储模块
3053
2960
  */
3054
- isAutoDelete?: boolean;
2961
+ localStorage: IStorage;
3055
2962
  /**
3056
- * 是否强制覆盖
2963
+ * 在某些非浏览器平台,其等同于 localStorage
3057
2964
  */
3058
- isForce?: boolean;
2965
+ sessionStorage: IStorage;
2966
+ /**
2967
+ * 获取网络状态
2968
+ * 2g 3g 4g wifi unkown
2969
+ */
2970
+ getNetworkType(): Promise<NetworkType>;
3059
2971
  }
3060
2972
 
3061
2973
  /**
3062
- * @category Interface
2974
+ * 拓展方法定义,便于 electron-solution 实现时保持接口类型推导可用
3063
2975
  */
3064
- interface IUploadAuth {
2976
+ interface IExtraMethod {
2977
+ getConversationsByPage(conversationTypes: ConversationType[], sentTime: number, count: number, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
2978
+ getHistoryMessagesByObjectNames(conversationType: ConversationType, targetId: string, sentTime: number, count: number, objectNames: string[], desc: 0 | 1, tag: string): Promise<IAsyncRes<{
2979
+ list: IReceivedMessage[];
2980
+ hasMore: boolean;
2981
+ }>>;
2982
+ updateMessageReceiptStatus(conersationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<IAsyncRes<boolean>>;
2983
+ }
2984
+
2985
+ /**
2986
+ * 导航信息数据就结构
2987
+ */
2988
+ interface INaviInfo {
3065
2989
  /**
3066
- * 七牛 token 有效期
3067
- */
3068
- deadline: number;
2990
+ * Navi 数据请求响应码,200 为成功请求
2991
+ */
2992
+ code: number;
3069
2993
  /**
3070
- * 七牛上传 token
3071
- */
3072
- token: string;
2994
+ * 获取 Navi 数据失败时的提示信息
2995
+ */
2996
+ errorMessage?: string;
3073
2997
  /**
3074
- * 百度上传 token
3075
- */
3076
- bosToken: string;
2998
+ * 获取 Navi 数据失败时的请求 url 信息
2999
+ */
3000
+ url?: string;
3077
3001
  /**
3078
- * 百度上传 header Date
3079
- */
3080
- bosDate: string;
3002
+ * 请求导航数据时使用的协议:http / https
3003
+ * @description 该字段为 SDK 内增加的字段,导航接口数据中不存在
3004
+ */
3005
+ protocol: 'http' | 'https';
3081
3006
  /**
3082
- * 百度上传路径
3083
- */
3084
- path: string;
3007
+ * 获取导航时使用的 userId,小程序不走导航,故拿不到 userId
3008
+ */
3009
+ userId?: string;
3085
3010
  /**
3086
- * 上传文件名,阿里上传获取下载地址时,必须使用上传文件名,所以需抛出到业务端
3011
+ * CMP 服务 Websocket 连接地址,包含域名与端口,不含 ws 或 wss 协议头
3012
+ * @example a.domain.com:443
3087
3013
  */
3088
- fileName: string;
3014
+ server: string;
3089
3015
  /**
3090
- * 阿里云 oss AccessKeyId
3016
+ * 备用 CMP 服务地址,包含域名与端口,不含 ws 或 wss 协议头,多个备用地址以 ',' 分割
3017
+ * @example a.domain.com:443,b.domain.com:443
3091
3018
  */
3092
- osskeyId: string;
3019
+ backupServer?: string;
3093
3020
  /**
3094
- * 阿里云 oss post 请求表单域中的字段 policy
3021
+ * 备用 CMP 服务地址,POST 请求 TCP 连接返回的是 bs 字段,非 backupServer 字段
3095
3022
  */
3096
- ossPolicy: string;
3023
+ bs?: string;
3097
3024
  /**
3098
- * 阿里云 oss 根据 policy 计算的签名信息
3025
+ * RTC 服务配置,其值可能为 null、无效字符串、有效 JSON 字符串
3026
+ * 1. 公有云未开通音视频时,值为 null
3027
+ * 2. 私有云无配置时为 `{ "strategy": 0 }`
3099
3028
  */
3100
- ossSign: string;
3029
+ voipCallInfo: string | null;
3101
3030
  /**
3102
- * 阿里云 oss 存储空间名称
3031
+ * 聊天室 kv 存储开关
3032
+ * @todo 需确认详细有效值
3033
+ * @description 公有云独有配置
3103
3034
  */
3104
- ossBucketName: string;
3035
+ kvStorage: number;
3105
3036
  /**
3106
- * s3 认证凭证,对应 post上传 x-amz-credential 字段
3037
+ * HttpDNS 功能开关,在 web 端无效
3038
+ * @description 公有云独有配置
3107
3039
  */
3108
- s3Credential: string;
3040
+ openHttpDNS: boolean;
3109
3041
  /**
3110
- * 加密算法,对应 post上传 x-amz-algorithm 字段
3042
+ * 历史消息云存储功能开关
3043
+ * @description
3044
+ * 1. 公有云通过 `developer.rongcloud.cn` 管理后台 `单群聊消息云端存储` 功能开关进行配置
3045
+ * 2. 私有云默认为 `true`
3111
3046
  */
3112
- s3Algorithm: string;
3047
+ historyMsg: boolean;
3113
3048
  /**
3114
- * s3 日期,对应 post上传 x-amz-date 字段
3049
+ * 聊天室历史消息开关
3050
+ * @description
3051
+ * 1. 私有云对聊天室功能支持有限,默认为 `false`
3052
+ * 2. TODO: 公有云配置待确认
3115
3053
  */
3116
- s3Date: string;
3054
+ chatroomMsg: boolean;
3117
3055
  /**
3118
- * s3 policy,对应 post上传 policy 字段
3056
+ * 文件服务器地址
3057
+ * @description
3058
+ * 1. 公有云下,该地址为七牛云服务器地址
3059
+ * 2. 私有云下,该地址为私有云自研文件服务器地址
3119
3060
  */
3120
- s3Policy: string;
3061
+ uploadServer: string;
3121
3062
  /**
3122
- * s3 签名信息,对应 post上传 x-amz-signature 字段
3063
+ * 实时位置共享配置,web 端无需处理
3123
3064
  */
3124
- s3Signature: string;
3065
+ location: null | string;
3125
3066
  /**
3126
- * s3 存储空间名称
3067
+ * 实时日志上传开关
3068
+ * @todo 需确认有效值及作用
3127
3069
  */
3128
- s3BucketName: string;
3070
+ monitor: number;
3129
3071
  /**
3130
- * stc Authorization 头
3072
+ * 是否允许加入多聊天室开关
3131
3073
  */
3132
- stcAuthorization: string;
3074
+ joinMChrm: boolean;
3133
3075
  /**
3134
- * stc xAmzContentSha256
3076
+ * 是否开启公众号功能:`0` 为未开启,`1` 为已开启
3135
3077
  */
3136
- stcContentSha256: string;
3078
+ openMp: 0 | 1;
3137
3079
  /**
3138
- * stc date
3080
+ * 是否开启用户级配置,若开启,需连接成功后立即拉取实时配置,0 | 1
3081
+ * @description
3082
+ * 配置来源:
3083
+ * 1. 导航
3084
+ * 2. 服务端实时下发
3085
+ * 已有配置字段:
3086
+ * 1. Lan. 推送使用的语言设置,用户端可自定义修改. Web 端未做设置, 只做接收
3087
+ * 2. ShPushSwit. 推送是否显示详情设置,用户端可自定义修改. Web 端未做设置, 只做接收
3088
+ * 3. MobPushSwit: Web/PC 在线,移动端不在线是否发送推送开关,用户端可自定义修改. Web 端未做设置, 只做接收
3089
+ * 4. OffMsgDur: 离线消息保存天数,设置天数不可大于App级对应配置,用户端可自定义修改. Web 端未做设置, 只做接收
3090
+ * 5. VoipInfo: 音视频相关配置,用户端不可自定义修改. 由服务端决定,与导航下发格式一致
3091
+ * @todo 需确认公有云与私有云区别
3139
3092
  */
3140
- stcDate: string;
3093
+ openUS: 0 | 1;
3141
3094
  /**
3142
- * stc 存储空间名称
3095
+ * 超级群功能开关,1表示开
3143
3096
  */
3144
- stcBucketName: string;
3145
- }
3146
-
3147
- interface IRTCRoomInfo {
3148
- roomId: string;
3149
- roomData: unknown[];
3150
- userCount: number;
3151
- list: unknown[];
3152
- }
3153
- interface IRtcTokenData {
3154
- rtcToken: string;
3155
- }
3156
- interface IRTCUsers {
3157
- users: {
3158
- [userId: string]: {
3159
- /**
3160
- * 发布的资源数据,是一个 JSON 字符串,解析后为发布的资源列表
3161
- */
3162
- uris?: string;
3163
- /**
3164
- * 加房间的身份标识,保存主房间 roomId
3165
- */
3166
- extra?: string;
3167
- };
3168
- };
3169
- }
3170
- interface IJoinRTCRoomData extends IRTCUsers {
3171
- token: string;
3172
- sessionId: string;
3173
- roomInfo: {
3174
- key: string;
3175
- value: string;
3176
- }[];
3177
- kvEntries: IServerRTCRoomEntry[];
3178
- offlineKickTime: number;
3179
- }
3180
- interface KVString {
3181
- [key: string]: string;
3182
- }
3183
- /**
3184
- * 设置 RTC 人员 inner、outer 数据
3185
- */
3186
- interface IRTCUserData {
3187
- [key: string]: string;
3188
- }
3189
-
3190
- /**
3191
- * @category Interface
3192
- */
3193
- interface IAsyncRes<T = void> {
3097
+ ugMsg?: 0 | 1;
3194
3098
  /**
3195
- * Promise 执行结果
3099
+ * 群离线消息最大下发条数,`0` 为关闭
3100
+ * @description 公有云独有配合
3196
3101
  */
3197
- code: ErrorCode;
3102
+ grpMsgLimit: number;
3198
3103
  /**
3199
- * 结果数据
3104
+ * 消息加密开关,0 为关闭
3105
+ * @todo
3106
+ * 1. 确定其控制的功能
3107
+ * 2. 确定 web 相关性
3200
3108
  */
3201
- data?: T;
3109
+ isFormatted: number;
3202
3110
  /**
3203
- * 错误消息
3111
+ * GIF 动图大小限制,默认 2048 KB
3204
3112
  */
3205
- msg?: string;
3206
- }
3207
- /**
3208
- * 异步任务结果定义
3209
- * @description
3210
- * 通过 `Promise.resolve` 来处理预期内的异常,进而通过 Uncatch Promise Error 暴露预期外的异常
3211
- */
3212
- declare type IPromiseResult<T = void> = Promise<IAsyncRes<T>>;
3213
- interface IConnectResult {
3113
+ gifSize: number;
3214
3114
  /**
3215
- * 连接错误码
3115
+ * 上传小视频时长限制,单位:秒
3116
+ * @description 公有云字段,即私有云配置中的 `uploadVideoTimeLimit`
3216
3117
  */
3217
- code: ErrorCode;
3118
+ videoTimes?: number;
3218
3119
  /**
3219
- * 导航获取成功后即可有相应的值,在导航数据获取完成之前该值为 undefined
3120
+ * 上传小视频时长限制,单位:秒
3121
+ * @description 私有云字段,即公有云配置中的 `videoTimes`
3220
3122
  */
3221
- userId?: string;
3222
- }
3223
-
3224
- declare enum HttpMethod {
3225
- GET = "GET",
3226
- POST = "POST"
3227
- }
3228
- interface IRequest {
3229
- url: string;
3123
+ uploadVideoTimeLimit?: number;
3230
3124
  /**
3231
- * @default `HttpMethod.GET`
3125
+ * 实时日志上传开关:`0` 为关闭,`1` 为开启
3232
3126
  */
3233
- method?: HttpMethod | 'GET' | 'POST';
3127
+ logSwitch: number;
3234
3128
  /**
3235
- * 查询数据
3129
+ * 实时日志上传策略,值为 JSON 字符串
3130
+ * @example `'{
3131
+ * "url": "logcollection.ronghub.com", // 上传地址
3132
+ * "level": 1, // 日志等级
3133
+ * "itv": 6, // 上传频率,即时间间隔,单位 s
3134
+ * "times": 5 // 重试次数?
3135
+ * }'`
3236
3136
  */
3237
- query?: {
3238
- [key: string]: string | number | null;
3239
- };
3137
+ logPolicy: string;
3240
3138
  /**
3241
- * Request Header 信息
3139
+ * 百度 BOS 存储服务地址
3140
+ * @description 公有云独有配置
3141
+ * @example `gz.bcebos.com`
3242
3142
  */
3243
- headers?: {
3244
- [key: string]: string;
3245
- };
3143
+ bosAddr?: string;
3246
3144
  /**
3247
- * Request Body 数据
3145
+ * 阿里上传配置,字符串数组,数组顺序代表 七牛、百度、阿里云 上传权重
3146
+ * @example
3147
+ * ```
3148
+ * `[{"qiniu":"upload.qiniup.com","p":"1"},
3149
+ * {"baidu":"gz.bcebos.com","p":"2"},
3150
+ * {"aliyun":"oss-cn-beijing.aliyuncs.com","p":"3"}]`
3151
+ * ```
3248
3152
  */
3249
- body?: Object | string;
3153
+ ossConfig?: string;
3250
3154
  /**
3251
- * 超时设置,默认 `60s`
3155
+ * 私有云专有属性,可用来判断当前环境是公有云还是私有云,私有云环境下该值为 `1`
3252
3156
  */
3253
- timeout?: number;
3157
+ type?: number;
3254
3158
  /**
3255
- * 【Alipay-Only】
3256
- * 期望返回的数据格式,如果为 json 则返回后会对返回的数据进行一次 JSON.parse
3159
+ * @deprecated 已废弃
3257
3160
  */
3258
- dataType?: 'json' | 'text' | 'base64' | 'arraybuffer';
3259
- }
3260
- interface IStorage {
3261
- setItem(key: string, value: string): void;
3262
- getItem(key: string): string | null;
3263
- removeItem(key: string): void;
3264
- clear(): void;
3265
- }
3266
- interface IResponse {
3267
- status: number;
3268
- data?: string;
3269
- }
3270
- /**
3271
- * 网络状态枚举
3272
- */
3273
- declare enum NetworkType {
3274
- WIFI = "wifi",
3275
- FOUR_G = "4g",
3276
- THREE_G = "3g",
3277
- TWO_G = "2g",
3278
- FIVE_G = "2g",
3279
- THREE_GENT = "3gnet",
3280
- UNKONWN = "unknown"
3281
- }
3282
- interface IWebSocket {
3161
+ compDays: number;
3283
3162
  /**
3284
- * 监听连接建立事件,此时 WebSocket 实例已准备好收发数据
3285
- * @param callback
3163
+ * @deprecated 已废弃
3286
3164
  */
3287
- onOpen(callback: () => void): void;
3165
+ msgAck: unknown;
3288
3166
  /**
3289
- * 监听连接关闭事件
3290
- * @param callback
3167
+ * @deprecated 已废弃
3291
3168
  */
3292
- onClose(callback: (code?: number, reason?: string) => void): void;
3169
+ activeServer: string;
3170
+ /**
3171
+ * @deprecated 已废弃
3172
+ */
3173
+ qnAddr: string;
3174
+ /**
3175
+ * @deprecated 已废弃
3176
+ */
3177
+ extkitSwitch: number;
3178
+ /**
3179
+ * @deprecated 已废弃
3180
+ */
3181
+ alone: boolean;
3182
+ /**
3183
+ * @deprecated 已废弃
3184
+ */
3185
+ voipServer: string;
3186
+ /**
3187
+ * 离线日志上报地址
3188
+ * @deprecated 已废弃
3189
+ */
3190
+ offlinelogserver: string;
3191
+ /**
3192
+ * 在线日志上报地址
3193
+ * @deprecated 已废弃
3194
+ */
3195
+ onlinelogserver?: string;
3293
3196
  /**
3294
- * 监听接收服务器消息事件
3295
- * @param callback
3197
+ * 链路加密字段,内容为 JSON 字符串,仅限 C++ 可用
3296
3198
  */
3297
- onMessage(callback: (data: string | ArrayBuffer) => void): void;
3199
+ crypto?: string;
3298
3200
  /**
3299
- * 监听链接错误事件
3300
- * @param callback
3201
+ * 群组回执开关, 1: 打开,0(或者没有): 关闭
3301
3202
  */
3302
- onError(callback: (error: unknown) => void): void;
3203
+ grpRRVer?: number;
3303
3204
  /**
3304
- * 向服务器发送数据
3305
- * @param data
3205
+ * 防黑产开关, 1: 打开,0:关闭
3306
3206
  */
3307
- send(data: ArrayBuffer | string): void;
3207
+ openAnti?: number;
3308
3208
  /**
3309
- * 关闭连接
3310
- * @param code
3311
- * @param reason
3209
+ * 鉴权认证
3312
3210
  */
3313
- close(code?: number, reason?: string): void;
3211
+ jwt?: string;
3314
3212
  }
3213
+
3214
+ declare type INaviCache = {
3215
+ token: string;
3216
+ naviInfo: INaviInfo;
3217
+ timestamp: number;
3218
+ };
3315
3219
  /**
3316
- * 平台运行时抽象
3220
+ * 导航数据管理类,负责管理导航有效期、导航请求、导航缓存
3317
3221
  */
3318
- interface IRuntime {
3222
+ declare abstract class BasicNavi {
3223
+ protected readonly appkey: string;
3224
+ protected readonly logger: BasicLogger;
3319
3225
  /**
3320
- * 平台标识
3226
+ * 业务层的自定义导航配置
3321
3227
  */
3322
- tag: string;
3228
+ protected readonly navigators: string[];
3229
+ constructor(appkey: string, logger: BasicLogger,
3323
3230
  /**
3324
- * 发送 http 请求
3325
- * @param options
3231
+ * 业务层的自定义导航配置
3326
3232
  */
3327
- httpReq(options: IRequest): Promise<IResponse>;
3233
+ navigators: string[]);
3328
3234
  /**
3329
- * 是否使用导航
3235
+ * 当前进行中的导航请求
3330
3236
  */
3331
- useNavi: boolean;
3237
+ private crtRequest;
3332
3238
  /**
3333
- * websocket 地址上附加的平台字段
3239
+ * 请求导航数据
3240
+ * @param token
3241
+ * @param ignoreCache 是否忽略缓存,强制从服务器重新拉取。
3242
+ * @param ignoreExpire 是否忽略有效期检查。理论上只需要在建立连接时需要检测 navi 有效期,其他场景无需检测
3243
+ * @param traceId 事务日志跟踪 ID
3334
3244
  */
3335
- connectPlatform: string;
3245
+ request(token: string, ignoreCache: boolean, ignoreExpire: boolean, traceId: string): IPromiseResult<INaviInfo>;
3246
+ private sendRequest;
3336
3247
  /**
3337
- * websocket 地址上 apiVer 字段,代表代码是否来源于 uniapp
3248
+ * 从指定服务列表中顺序尝试获取导航
3249
+ * @param uris 导航服务列表
3250
+ * @param token
3251
+ * @param traceId
3338
3252
  */
3339
- isFromUniapp: boolean;
3253
+ private requestHandler;
3340
3254
  /**
3341
- * 创建长连接实例
3255
+ * 向目标导航服务发送请求
3256
+ * @param uri 导航服务地址
3257
+ * @param appkey
3258
+ * @param token
3259
+ * @param version
3260
+ * @param timeout 请求超时时间
3261
+ * @param traceId
3342
3262
  */
3343
- createWebSocket?(url: string, protocols?: string[]): IWebSocket;
3263
+ protected abstract httpRequest(uri: string, appkey: string, token: string, version: string, timeout: number, traceId: string): IPromiseResult<INaviInfo>;
3344
3264
  /**
3345
- * 存储模块
3265
+ * 转换 Navi 接口 HTTP 请求状态码为 ErrorCode 定义
3266
+ * @param code
3346
3267
  */
3347
- localStorage: IStorage;
3268
+ protected transHttpCode(code: number): ErrorCode;
3348
3269
  /**
3349
- * 在某些非浏览器平台,其等同于 localStorage
3270
+ * 设置缓存
3271
+ * @param formatedToken
3272
+ * @param naviInfo
3273
+ * @description 设置缓存的同时会检测缓存中的既有数据,适当清理,避免无效数据长时间占用存储空间
3350
3274
  */
3351
- sessionStorage: IStorage;
3275
+ protected abstract setNaviCache(formatedToken: string, naviInfo: INaviInfo): void;
3352
3276
  /**
3353
- * 获取网络状态
3354
- * 2g 3g 4g wifi unkown
3277
+ * 获取缓存数据
3278
+ * @param formatedToken
3355
3279
  */
3356
- getNetworkType(): Promise<NetworkType>;
3280
+ protected abstract getNaviCache(formatedToken: string): INaviCache | null;
3281
+ /**
3282
+ * 获取缓存的导航信息
3283
+ * @param token
3284
+ */
3285
+ getNaviInfoFromCache(token: string): INaviInfo | null;
3286
+ /**
3287
+ * RTC 配置变更,更新 navi 缓存
3288
+ * @param token
3289
+ * @param voipCallInfo
3290
+ */
3291
+ updateVoipCallInfo(token: string, voipCallInfo: string): void;
3357
3292
  }
3358
3293
 
3359
3294
  /**
3360
- * 拓展方法定义,便于 electron-solution 实现时保持接口类型推导可用
3295
+ * Websocket 导航工具类
3361
3296
  */
3362
- interface IExtraMethod {
3363
- getConversationsByPage(conversationTypes: ConversationType[], sentTime: number, count: number, channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
3364
- getHistoryMessagesByObjectNames(conversationType: ConversationType, targetId: string, sentTime: number, count: number, objectNames: string[], desc: 0 | 1, tag: string): Promise<IAsyncRes<{
3365
- list: IReceivedMessage[];
3366
- hasMore: boolean;
3367
- }>>;
3368
- updateMessageReceiptStatus(conersationType: ConversationType, targetId: string, timestamp: number, channelId?: string): Promise<IAsyncRes<boolean>>;
3297
+ declare class WebSocketNavi extends BasicNavi {
3298
+ private runtime;
3299
+ /**
3300
+ * 小程序平台服务地址,多个地址以 ',' 分割
3301
+ */
3302
+ private readonly miniCmpUris;
3303
+ constructor(appkey: string, logger: BasicLogger, runtime: IRuntime,
3304
+ /**
3305
+ * 小程序平台服务地址,多个地址以 ',' 分割
3306
+ */
3307
+ miniCmpUris: string, navigators?: string[]);
3308
+ protected httpRequest(uri: string, appkey: string, token: string, version: string, timeout: number, traceId: string): IPromiseResult<INaviInfo>;
3309
+ protected getNaviCache(formatedToken: string): INaviCache | null;
3310
+ protected setNaviCache(formatedToken: string, naviInfo: INaviInfo): void;
3369
3311
  }
3370
3312
 
3371
3313
  /**
@@ -3459,17 +3401,216 @@ interface IProcessInfo {
3459
3401
  }
3460
3402
 
3461
3403
  /**
3462
- * engine 基本接口定义,用于约束 Electron 下主进程、渲染进程、JSEngine 的编码一致性
3404
+ * 连接状态定义枚举值
3463
3405
  */
3464
- interface IEngine {
3406
+ declare enum RCConnectionStatus {
3407
+ /**
3408
+ * 已连接
3409
+ */
3410
+ CONNECTED = 0,
3411
+ /**
3412
+ * 连接中
3413
+ */
3414
+ CONNECTING = 1,
3415
+ /**
3416
+ * 无连接,或已断开
3417
+ */
3418
+ DISCONNECTED = 2,
3419
+ /**
3420
+ * 连接暂停状态,SDK 内部 5s 后会自动尝试重连
3421
+ */
3422
+ SUSPENDED = 3
3423
+ }
3424
+ interface IConnectionListener {
3425
+ /**
3426
+ * 连接成功
3427
+ */
3428
+ onConnected(): void;
3429
+ /**
3430
+ * 连接中止,SDK 内部会进行重连
3431
+ * @param code 中止原因
3432
+ */
3433
+ onSuspend(code: ErrorCode): void;
3434
+ /**
3435
+ * 连接中
3436
+ */
3437
+ onConnecting(): void;
3438
+ /**
3439
+ * 连接已终止
3440
+ * @param code 连接终止原因
3441
+ */
3442
+ onDisconnected(code: ErrorCode): void;
3443
+ }
3444
+ /**
3445
+ * 抽象连接管理器类,负责 engine 层的连接状态维持,和对外的连接状态通知
3446
+ */
3447
+ declare abstract class AConnectionMgr {
3448
+ protected readonly appkey: string;
3449
+ private navi;
3450
+ protected logger: BasicLogger;
3451
+ private listener;
3452
+ constructor(appkey: string, navi: BasicNavi, logger: BasicLogger, listener: IConnectionListener);
3453
+ /**
3454
+ * 当前连接所用 token
3455
+ */
3456
+ private token;
3457
+ /**
3458
+ * 获取当前连接中使用的 token
3459
+ * @returns
3460
+ */
3461
+ getToken(): string;
3462
+ private reconnectKick;
3463
+ /**
3464
+ * 当前连接状态
3465
+ */
3466
+ private _crtConnectionStatus;
3467
+ /**
3468
+ * 当前用户 ID
3469
+ */
3470
+ protected _crtUserId: string;
3471
+ /**
3472
+ * 获取当前用户 ID
3473
+ * @returns
3474
+ */
3475
+ getCurrentUserId(): string;
3476
+ /**
3477
+ * 修改连接状态
3478
+ * @param status
3479
+ * @param code
3480
+ */
3481
+ private setConnectionStatus;
3482
+ /**
3483
+ * 获取当前连接状态
3484
+ * @returns
3485
+ */
3486
+ getConnectionStatus(): RCConnectionStatus;
3465
3487
  /**
3466
3488
  * 建立连接
3467
3489
  * @param token
3490
+ * @param reconnectKickEnable 设置断线重连时是否踢出当前正在重连的设备 (仅 Electron 环境有效)
3491
+ * 同一个账号在一台新设备上登录的时候,会把这个账号在之前登录的设备上踢出。
3492
+ * 由于 SDK 有断线重连功能,存在下面情况。
3493
+ * 用户在 A 设备登录,A 设备网络不稳定,没有连接成功,SDK 启动重连机制。
3494
+ * 用户此时又在 B 设备登录,B 设备连接成功。
3495
+ * A 设备网络稳定之后,用户在 A 设备连接成功,B 设备被踢出。
3496
+ * 这个字段就是为这种情况加的。
3497
+ * 设置 reconnectKickEnable 为 true 时,SDK 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
3498
+ */
3499
+ connect(token: string, reconnectKickEnable: boolean, traceId: string): IPromiseResult<string>;
3500
+ /**
3501
+ * 执行中的连接事务
3502
+ */
3503
+ private _crtConnectionTask;
3504
+ /**
3505
+ * 尝试建立连接
3506
+ * @param token
3507
+ * @param reconnectKickEnable
3508
+ * @param ignoreNaviCache
3509
+ * @param traceId
3510
+ * @description 函数会检测当前是否有进行中的连接任务,若存在,则直接返回当前连接任务
3511
+ */
3512
+ private try2Connect;
3513
+ /**
3514
+ * 创建连接任务
3515
+ * @param token
3516
+ * @param reconnectKickEnable
3517
+ * @param ignoreNaviCache
3518
+ * @param traceId
3519
+ * @returns
3520
+ */
3521
+ private createConnectionTask;
3522
+ private reconnectTimer;
3523
+ /**
3524
+ * 尝试重连
3525
+ * @param ignoreNaviCache 是否忽略 navi 缓存以重新请求 navi
3526
+ */
3527
+ private try2Reconnect;
3528
+ /**
3529
+ * 服务器主动断开时由子类调用,函数将根据 reason 确定是否尝试重连
3530
+ * @param reason
3531
+ */
3532
+ protected onDisconnectByServer(code: ErrorCode): void;
3533
+ /**
3534
+ * Socket 异常中断时由子类调用,SDK 尝试恢复重连
3535
+ */
3536
+ protected onDisconenctUnusual(code: ErrorCode): void;
3537
+ /**
3538
+ * 建立 Socket 连接,由子类集成实现
3539
+ * @param token
3468
3540
  * @param naviInfo
3469
3541
  * @param reconnectKickEnable
3542
+ * @param traceId
3543
+ */
3544
+ protected abstract connectWithToken(token: string, naviInfo: INaviInfo, reconnectKickEnable: boolean, traceId: string): IPromiseResult<string>;
3545
+ /**
3546
+ * 当前累计心跳超时次数
3547
+ */
3548
+ private _failedCount;
3549
+ /**
3550
+ * 允许连续 PING 超时次数,超出指定次数后会主动关闭 socket 并重新连接
3551
+ */
3552
+ private readonly ALLOW_FAILED_TIMES;
3553
+ /**
3554
+ * 启动心跳计时器
3555
+ */
3556
+ private checkAlive;
3557
+ /**
3558
+ * 关闭连接
3559
+ * @param inReconnect
3560
+ */
3561
+ protected abstract close(inReconnect: boolean): void;
3562
+ /**
3563
+ * 完成一次 ping 过程,并返回响应状态码
3564
+ * @param timeout 超时时间
3565
+ */
3566
+ protected abstract sendPing(timeout: number): Promise<ErrorCode>;
3567
+ /**
3568
+ * 业务层主动断开连接时调用
3569
+ */
3570
+ disconnect(): Promise<void>;
3571
+ /**
3572
+ * 清理重连计时器
3573
+ */
3574
+ private stopReconnectTimer;
3575
+ }
3576
+
3577
+ /**
3578
+ * 查询错误码是否为服务下发的 disconnect 通知 status 所转换
3579
+ * @param code
3580
+ * @description 排除重定向 31006,因 disconnect 和 connAck 都包含元素可被转换为 31006
3581
+ */
3582
+ declare const isDisconnectCode: (code: ErrorCode) => boolean;
3583
+ /**
3584
+ * 查询错误码是否为服务下发的 connAck status 所转换
3585
+ * @param code
3586
+ * @description 排除重定向 31006,因 disconnect 和 connAck 都包含元素可被转换为 31006
3587
+ */
3588
+ declare const isConnnectAckCode: (code: ErrorCode) => boolean;
3589
+
3590
+ /**
3591
+ * 进程内缓存数据
3592
+ */
3593
+ interface IProcessCache {
3594
+ crtUserId: string;
3595
+ connectedTime: number;
3596
+ naviInfo: INaviInfo | null;
3597
+ connectionStatus: RCConnectionStatus;
3598
+ deviceId: string;
3599
+ }
3600
+ /**
3601
+ * 约束主进程 CppEngine 与 CppService 间的方法定义,以便于代码检查
3602
+ */
3603
+ interface IEngine {
3604
+ /**
3605
+ * 注册本渲染进程至主进程,以接收主进程的消息通知,同时同步主进程的当前缓存数据
3606
+ */
3607
+ getMainProcessCache(): IProcessCache;
3608
+ /**
3609
+ * 建立连接
3610
+ * @param token
3611
+ * @param reconnectKickEnable
3470
3612
  */
3471
- connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean): Promise<ErrorCode>;
3472
- requestNaviInfo(uris: string[], appkey: string, token: string, checkCA?: boolean): Promise<INaviInfo | null>;
3613
+ connect(token: string, reconnectKickEnable: boolean, traceId: string): IPromiseResult<string>;
3473
3614
  getNaviInfoFromCache(): INaviInfo | null;
3474
3615
  /**
3475
3616
  * 上报版本信息
@@ -3591,6 +3732,10 @@ interface IEngine {
3591
3732
  * 获取指定会话
3592
3733
  */
3593
3734
  getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
3735
+ /**
3736
+ * 获取未读会话列表
3737
+ */
3738
+ getUnreadConversationList(conversationTypes: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
3594
3739
  /**
3595
3740
  * 删除会话
3596
3741
  * @description 该删除操作会删除服务器端存储的会话数据
@@ -3879,7 +4024,7 @@ interface IEngine {
3879
4024
  /**
3880
4025
  * 获取消息
3881
4026
  */
3882
- getMessage(messageId: number): IPromiseResult<IReceivedMessage>;
4027
+ getMessage(messageId: number | string): IPromiseResult<IReceivedMessage>;
3883
4028
  /**
3884
4029
  * 设置消息内容
3885
4030
  */
@@ -3951,7 +4096,7 @@ interface IEngine {
3951
4096
  /**
3952
4097
  * 无差别获取本地置顶列表
3953
4098
  */
3954
- getTopConversationList(): Promise<IAsyncRes<IBaseConversationInfo[]>>;
4099
+ getTopConversationList(conversationTypes?: ConversationType[], channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
3955
4100
  /**
3956
4101
  * 获取单个群聊会话 @ 消息未读数
3957
4102
  */
@@ -3969,6 +4114,18 @@ interface IEngine {
3969
4114
  * 获取应用主进程信息,仅限 Electron 平台可用
3970
4115
  */
3971
4116
  getMainProcessInfo(): IPromiseResult<IProcessInfo>;
4117
+ /**
4118
+ * 设置代理
4119
+ */
4120
+ setProxy(proxy: IProxy | null): IPromiseResult<IProxy>;
4121
+ /**
4122
+ * 获取代理
4123
+ */
4124
+ getProxy(): IPromiseResult<IProxy>;
4125
+ /**
4126
+ * 测试代理
4127
+ */
4128
+ testProxy(proxy: IProxy, testHost: string): Promise<IResponse>;
3972
4129
  rtcPing(roomId: string, mode: number, broadcastType?: number): Promise<IAsyncRes<any>>;
3973
4130
  rtcSignaling(roomId: string, method: string, isQuery: boolean, sourceData: any): Promise<{
3974
4131
  code: ErrorCode;
@@ -4202,65 +4359,49 @@ interface IEndRoomPKOptions {
4202
4359
  /**
4203
4360
  * 消息送达相关接口
4204
4361
  */
4362
+ /**
4363
+ * 送达的用户信息
4364
+ * @hidden
4365
+ */
4205
4366
  interface IDeliveredUser {
4206
4367
  time: number;
4207
4368
  userId: string;
4208
4369
  }
4370
+ /**
4371
+ * 获取群组消息送达的状态信息
4372
+ * @hidden
4373
+ */
4209
4374
  interface IGroupMessageDeliverInfo {
4210
4375
  totalCount: number;
4211
4376
  list: IDeliveredUser[];
4212
4377
  }
4378
+ /**
4379
+ * 单聊消息送达通知数据
4380
+ * @hidden
4381
+ */
4213
4382
  interface IMessageDeliver {
4214
4383
  deliverTime: number;
4215
4384
  messageUId: string;
4216
4385
  objectName: string;
4217
4386
  targetId: string;
4218
4387
  }
4388
+ /**
4389
+ * 群组消息送达通知数据信息
4390
+ * @hidden
4391
+ */
4219
4392
  interface IGroupMessageDeliveredStatusInfo {
4220
4393
  MessageUId: string;
4221
4394
  deliveryCount: number;
4222
4395
  }
4396
+ /**
4397
+ * 群组消息送达通知数据
4398
+ * @hidden
4399
+ */
4223
4400
  interface IGroupMessageDeliverStatus {
4224
4401
  totalCount: number;
4225
4402
  list: IGroupMessageDeliveredStatusInfo[];
4226
4403
  }
4227
4404
 
4228
- /**
4229
- * IndexDB中存储的log数据
4230
- */
4231
- interface ILogInfo {
4232
- sessionId: string;
4233
- time: number;
4234
- level: LogLevel;
4235
- content: string;
4236
- userId?: string;
4237
- logSource?: LogSource;
4238
- tagId?: LogTagId;
4239
- }
4240
- interface IRealTimeLog {
4241
- level: LogLevel;
4242
- content: string;
4243
- }
4244
- interface ILogExtensions {
4245
- traceId?: string;
4246
- logSource?: LogSource;
4247
- }
4248
- interface ILogInit {
4249
- userId?: string;
4250
- localLogLevel?: LogLevel;
4251
- customLogPrint?: (logLevel: LogLevel, msg: string) => void;
4252
- }
4253
- interface IInitBigDataOption {
4254
- runtime?: IRuntime;
4255
- appkey?: string;
4256
- version?: string;
4257
- userId?: string;
4258
- }
4259
- interface IBigdataLogInit extends IInitBigDataOption {
4260
- logUrl: string;
4261
- sessionId: string;
4262
- }
4263
-
4264
4405
  /**
4265
4406
  * 定义已废弃,请使用 `IRemoveChatroomEntries` 替换
4266
4407
  * @deprecated
@@ -4410,118 +4551,11 @@ declare const initLogDB: (appkey: string, logger: ILogger, expireTime?: number)
4410
4551
  declare const deInitLogDB: () => Promise<void>;
4411
4552
 
4412
4553
  /**
4413
- * 日志数据转为 csv 结构数据
4414
- * @param log
4415
- * @returns
4416
- */
4417
- declare const transcsv: (log: ILogData) => string;
4418
-
4419
- /**
4420
- * @description
4421
- * 读数据处理基类
4422
- */
4423
- declare class BaseReader {
4424
- readonly header: Header;
4425
- messageId: number;
4426
- timestamp: number;
4427
- syncMsg: boolean;
4428
- protected identifier: string;
4429
- constructor(header: Header);
4430
- getIdentifier(): string | number;
4431
- read(logger: ILogger, stream: RongStreamReader, length: number, protocolVer: ConnAckProtocolVer): void;
4432
- readMessage(logger: ILogger, stream: RongStreamReader, length?: number, protocolVer?: ConnAckProtocolVer): {
4433
- stream: RongStreamReader;
4434
- length: number | undefined;
4435
- };
4436
- }
4437
- /**
4438
- * @description
4439
- * 写数据处理基类
4440
- */
4441
- declare abstract class BaseWriter {
4442
- private _header;
4443
- lengthSize: number;
4444
- data: any;
4445
- messageId: number;
4446
- topic: string;
4447
- targetId: string;
4448
- identifier: string;
4449
- constructor(headerType: OperationType);
4450
- getIdentifier(): string | number;
4451
- write(stream: RongStreamWriter): void;
4452
- abstract writeMessage(stream: RongStreamWriter): void;
4453
- setHeaderQos(qos: number): void;
4454
- getHeaderFlag(): number;
4455
- getLengthSize(): number;
4456
- getBufferData(): Int8Array;
4457
- }
4458
- declare class RetryableReader extends BaseReader {
4459
- messageId: number;
4460
- readMessage(logger: ILogger, stream: RongStreamReader, length: number): {
4461
- stream: RongStreamReader;
4462
- length: number;
4463
- };
4464
- }
4465
- declare class RetryableWriter extends BaseWriter {
4466
- writeMessage(stream: RongStreamWriter): void;
4467
- }
4468
- declare class PublishReader extends RetryableReader {
4469
- topic: string;
4470
- data: any;
4471
- targetId: string;
4472
- date: any;
4473
- syncMsg: boolean;
4474
- identifier: string;
4475
- readMessage(logger: ILogger, stream: RongStreamReader, length: number): {
4476
- stream: RongStreamReader;
4477
- length: number;
4478
- };
4479
- }
4480
- /**
4481
- * @description
4482
- * 发消息使用
4483
- */
4484
- declare class PublishWriter extends RetryableWriter {
4485
- topic: string;
4486
- data: any;
4487
- targetId: string;
4488
- date: any;
4489
- syncMsg: boolean;
4490
- identifier: string;
4491
- constructor(topic: string, data: any, targetId: string);
4492
- writeMessage(stream: RongStreamWriter): void;
4493
- }
4494
- /**
4495
- * @description
4496
- * 发消息, Server 给的 Ack 回执
4497
- */
4498
- declare class PubAckReader extends RetryableReader {
4499
- status: number;
4500
- date: number;
4501
- data: any;
4502
- millisecond: number;
4503
- messageUId: string;
4504
- timestamp: number;
4505
- identifier: string;
4506
- topic: string;
4507
- targetId: string;
4508
- readMessage(logger: ILogger, stream: RongStreamReader, length: number): {
4509
- stream: RongStreamReader;
4510
- length: number;
4511
- };
4512
- }
4513
- /**
4514
- * @description
4515
- * Web 主动查询
4554
+ * 日志数据转为 csv 结构数据
4555
+ * @param log
4556
+ * @returns
4516
4557
  */
4517
- declare class QueryWriter extends RetryableWriter {
4518
- topic: string;
4519
- data: any;
4520
- targetId: string;
4521
- identifier: string;
4522
- constructor(topic: string, data: any, targetId: string);
4523
- writeMessage(stream: RongStreamWriter): void;
4524
- }
4558
+ declare const transcsv: (log: ILogData) => string;
4525
4559
 
4526
4560
  /**
4527
4561
  * 会话属性
@@ -4598,26 +4632,12 @@ interface IServerUserSetting {
4598
4632
  };
4599
4633
  version: number;
4600
4634
  }
4601
- interface ISyncMsgArgs {
4602
- inboxTime: number;
4603
- sendboxTime: number;
4604
- broadcastSyncTime?: number;
4605
- }
4606
4635
  interface IGetMsgOption {
4607
4636
  timestamp?: number;
4608
4637
  count?: number;
4609
4638
  order?: number;
4610
4639
  channelId?: string;
4611
4640
  }
4612
- interface IGetConversationListOption {
4613
- type?: number;
4614
- count?: number;
4615
- startTime?: number;
4616
- order?: 0 | 1;
4617
- }
4618
- interface IClearMsgOption {
4619
- timestamp?: number;
4620
- }
4621
4641
 
4622
4642
  /**
4623
4643
  * TODO: 确定对外暴露的必要性
@@ -4633,362 +4653,9 @@ declare const DelayTimer: {
4633
4653
  getTime: () => number;
4634
4654
  };
4635
4655
 
4636
- /**
4637
- * 序列化、反序列化数据通道
4638
- */
4639
- declare class DataCodec {
4640
- private logger;
4641
- private _codec;
4642
- constructor(logger: BasicLogger);
4643
- private static createPBCodec;
4644
- /**
4645
- * PB 数据 转为 rmtp 数据 反序列化 通用数据
4646
- * 根据解析的 PBName 分配解码方法. 如果没有单独的解码方法定义. 直接返回 pb 解析后的结果
4647
- */
4648
- decodeByPBName(data: any, pbName: string, option?: any): any;
4649
- private _readBytes;
4650
- /**
4651
- * ====== 以下为 rmtp 数据 反序列化为 可用数据 ======
4652
- */
4653
- private _formatBytes;
4654
- /**
4655
- * 格式化多端同步消息
4656
- */
4657
- private _formatSyncMessages;
4658
- /**
4659
- * 格式化接收消息
4660
- */
4661
- private _formatReceivedMessage;
4662
- /**
4663
- * 格式化发送消息
4664
- */
4665
- private _formatSentMessage;
4666
- /**
4667
- * 格式化历史消息
4668
- */
4669
- private _formatHistoryMessages;
4670
- /**
4671
- * 格式化超级群消息变更列表
4672
- */
4673
- private _formatUltraMsgChangeList;
4674
- /**
4675
- * 格式化超级群消息变更列表
4676
- */
4677
- private _formatUltraOperateStatusNotifyList;
4678
- /**
4679
- * 格式化超级群变更后消息列表
4680
- */
4681
- private _formatUltraMsgList;
4682
- /**
4683
- * 格式化超级群获取指定会话未读 @ 消息列表
4684
- */
4685
- private _formatUltraGroupUnreadMentionedList;
4686
- /**
4687
- * 格式化会话列表
4688
- */
4689
- private _formatConversationList;
4690
- /**
4691
- * 格式化用户设置
4692
- */
4693
- private _formatSetUserSettingOutput;
4694
- /**
4695
- * 格式化聊天室信息
4696
- */
4697
- private _formatChatRoomInfos;
4698
- /**
4699
- * 格式化 聊天室 KV 列表
4700
- */
4701
- private _formatChatRoomKVList;
4702
- /**
4703
- * 格式化 用户设置
4704
- */
4705
- private _formatUserSetting;
4706
- /**
4707
- * 格式化 会话状态 置顶、免打扰
4708
- */
4709
- private _formatConversationStatus;
4710
- /**
4711
- * 格式化 获取已读列表
4712
- */
4713
- private _formatGrpReadReceiptQryResp;
4714
- /**
4715
- * 格式化用户配置通知
4716
- */
4717
- private _formatUserSettingNotification;
4718
- /**
4719
- * 拉取聊天室 kv 存储时的最新时间戳
4720
- */
4721
- private _formatChrmKVVersion;
4722
- /**
4723
- * 格式化加入 RTC 房间的用户信息
4724
- */
4725
- private _formatRTCJoinedUserInfo;
4726
- /**
4727
- * ===== 以下为通用数据 序列化为 PB 数据 =====
4728
- * Engine Index 调用处理数据
4729
- */
4730
- /**
4731
- * ? 待补全注释
4732
- */
4733
- encodeServerConfParams(): any[];
4734
- /**
4735
- * 上行消息基础配置
4736
- */
4737
- private _getUpMsgModule;
4738
- /**
4739
- * 序列化上行消息
4740
- */
4741
- encodeUpMsg(conversation: IConversationOption, option: ISendMsgOptions): any[];
4742
- /**
4743
- * 序列化拉取多端消息
4744
- */
4745
- encodeSyncMsg(syncMsgArgs: ISyncMsgArgs): any[];
4746
- /**
4747
- * 序列化拉取聊天室消息
4748
- */
4749
- encodeChrmSyncMsg(time: number, count: number): any[];
4750
- /**
4751
- * 序列化历史消息所需参数
4752
- */
4753
- encodeGetHistoryMsg(targetId: string, option: IGetMsgOption): any[];
4754
- /**
4755
- * 序列化同步超级群所需参数
4756
- */
4757
- encodeSuperSyncMsg(syncTime: number): any[];
4758
- /**
4759
- * 序列化会话列表
4760
- */
4761
- encodeGetConversationList(option: IGetConversationListOption): any[];
4762
- /**
4763
- * 旧会话列表. 获取、删除都调用此方法
4764
- */
4765
- encodeOldConversationList(option: IGetConversationListOption): any[];
4766
- /**
4767
- * 旧会话列表删除,支持多组织
4768
- */
4769
- encodeRemoveOldConversationList(conversation: IConversationOption): any[];
4770
- /**
4771
- * 旧会话列表删除
4772
- */
4773
- encodeRemoveConversationList(conversationList: IConversationOption[]): any[];
4774
- /**
4775
- * 批量删除消息通过消息 ID
4776
- */
4777
- encodeDeleteMessages(conversationType: ConversationType, targetId: string, list: {
4778
- messageUId: string;
4779
- sentTime: number;
4780
- messageDirection: MessageDirection;
4781
- }[], channelId: string): any[];
4782
- /**
4783
- * 批量删除消息通过时间
4784
- */
4785
- encodeClearMessages(targetId: string, timestamp: number, channelId: string, conversationType?: ConversationType): any[];
4786
- /**
4787
- * 未读数清除
4788
- */
4789
- encodeClearUnreadCount(conversation: IConversationOption, option: IClearMsgOption): any[];
4790
- /**
4791
- * 对已有的超级群消息扩展
4792
- */
4793
- encodeExpandUltraMessage(option: IUltraExMsgOptions, userId: string): any[];
4794
- /**
4795
- * 对已有的超级群消息扩展
4796
- */
4797
- encodemodifyMessage(option: IUltraModifyMsgOptions, userId: string): any[];
4798
- /**
4799
- * 超级群消息变更通知
4800
- */
4801
- encodeQueryMsgChange(time: number): any[];
4802
- /**
4803
- * 超级群消息变更通知
4804
- */
4805
- encodeMsgQuery(option: IUltraMsgQueryOptions): any[];
4806
- /**
4807
- * 序列化获取超级群获取指定会话未读 @ 消息列表参数
4808
- */
4809
- encodeUnreadMentionedMsgQuery(option: IUltraGroupUnreadMentionedOption): any[];
4810
- /**
4811
- * 正在输入中
4812
- */
4813
- encodeOperateStatus(targetId: string, conversationType: ConversationType, channelId: string, operationType: OperateStatus): any[];
4814
- /**
4815
- * 加入退出聊天室
4816
- */
4817
- encodeJoinOrQuitChatRoom(): any[];
4818
- /**
4819
- * 获取聊天室信息
4820
- * @param count 获取人数
4821
- * @param order 排序方式
4822
- */
4823
- encodeGetChatRoomInfo(count: number, order: number): any[];
4824
- /**
4825
- * 设置指定超级群默认通知配置
4826
- * @param notificationLevel
4827
- * * NotificationLevel
4828
- * @param channelId 超级群频道 Id
4829
- */
4830
- encodeSetUltraGroupDefaultNotificationLevel(notificationLevel: NotificationLevel, channelId: string): any;
4831
- /**
4832
- * 查询指定超级群默认通知配置
4833
- * @param channelId 频道 ID
4834
- */
4835
- encodeGetUltraGroupDefaultNotificationLevel(channelId: string): any;
4836
- /**
4837
- * 上传文件认证信息获取
4838
- */
4839
- encodeGetFileToken(fileType: number, fileName: string, httpMethod?: string, queryString?: string): any;
4840
- /**
4841
- * 获取七牛上传url
4842
- */
4843
- encodeGetFileUrl(inputPBName: string, fileType: number, fileName?: string, originName?: string): any;
4844
- /**
4845
- * 聊天室 KV 存储
4846
- */
4847
- encodeModifyChatRoomKV(chrmId: string, entry: IChrmKVEntry, currentUserId: string): any;
4848
- encodeModifyChatRoomKVS(chrmId: string, entryOptions: IChrmKVEntries, currentUserId: string): any;
4849
- /**
4850
- * KV 存储拉取
4851
- */
4852
- encodePullChatRoomKV(time: number): any;
4853
- /**
4854
- * 用户实时配置更新
4855
- */
4856
- encodePullUserSetting(version: number): any;
4857
- /**
4858
- * 获取会话状态 (置顶、免打扰)
4859
- */
4860
- encodeGetConversationStatus(time: number): any;
4861
- /**
4862
- * 设置会话状态 (置顶、免打扰)
4863
- */
4864
- encodeSetConversationStatus(statusList: Array<ISetConversationStatusOptions>, conversationUpdatedTime: number): any;
4865
- /**
4866
- * 序列化发送群组已读回执
4867
- */
4868
- encodeReadReceipt(messageUIds: string[], channelId?: string): any;
4869
- /**
4870
- * 序列化创建tag消息
4871
- */
4872
- encodeCreateTag(tags: Array<ITagParam>, version: number): any;
4873
- /**
4874
- * 序列化获取群组消息已读列表
4875
- */
4876
- encodeMessageReader(messageUId: string, channelId?: string): any;
4877
- /**
4878
- * 序列化删除tag消息
4879
- */
4880
- encodeRemoveTag(tagIds: Array<string>, version: number): any;
4881
- /**
4882
- * 解除会话标签关系
4883
- */
4884
- encodeDisConversationTag(tagIds: Array<string>): any;
4885
- /**
4886
- * 序列化更新会话标签
4887
- */
4888
- encodeUpdateConversationTag(tags: IConversationTag[], conversations: IConversationOption[]): any;
4889
- /**
4890
- * 序列号上报SDK信息
4891
- */
4892
- encodeReportSDKInfo(info: string): any;
4893
- /**
4894
- * 序列号超级群获取会话参数
4895
- */
4896
- encodeUltraGroup(syncTime: number, isEraseMsgContent: boolean): any;
4897
- /**
4898
- * 设置聊天室关联的rtc房间
4899
- */
4900
- encodebindRTCRoomForChatroom(options: IRTCRoomBindOption): any;
4901
- }
4902
-
4903
- interface IDataChannelWatcher {
4904
- /**
4905
- * 连接状态变更通知
4906
- */
4907
- status: (status: ConnectionStatus) => void;
4908
- /**
4909
- * 业务信令通知
4910
- * @params signal
4911
- * @params ack 当接收到的数据为多端同步消息时,ack 值为 PubAck,否则为 undefined
4912
- */
4913
- signal: (signal: PublishReader, ack?: PubAckReader) => void;
4914
- }
4915
- /**
4916
- * @todo 迁移中的 DataCodec 模块导致数据通道不够独立,与 xhr-polling 通信可能会有耦合,后续需解耦
4917
- * @description
4918
- * 1. 基于 WebSocket 协议建立数据通道,实现数据收发
4919
- * 2. 基于 Protobuf 进行数据编解码
4920
- */
4921
- declare class WebSocketChannel {
4922
- private _runtime;
4923
- private _watcher;
4924
- private logger;
4925
- readonly codec: DataCodec;
4926
- connectedTime: number;
4927
- userId: string;
4928
- sendConnectTime: number;
4929
- private _socket;
4930
- private _pingResolve?;
4931
- /**
4932
- * 本端发送消息时等待接收 PubAck 的 Promise.resolve 函数
4933
- */
4934
- private _messageIds;
4935
- /**
4936
- * 接收多端同步消息时,等待 PubAck 的 Promise.resolve 函数
4937
- */
4938
- private _syncMessageIds;
4939
- constructor(_runtime: IRuntime, _watcher: IDataChannelWatcher, logger: BasicLogger);
4940
- /**
4941
- * 建立连接,连接成功则返回 Websocket 实例,否则返回连接错误码
4942
- * @param appkey
4943
- * @param token
4944
- * @param hosts 服务器地址,不包含协议头,`hostname:port`
4945
- * @param protocol 请求导航数据时使用的网络协议, /ping 与 websocket 需要继续遵循该协议
4946
- * @param apiVersion 需符合 `/\d+(\.\d+){2}/` 规则,对于预发布版本号如 `3.1.0-alpha.1` 需认定为 `3.1.0`
4947
- * @param protocolVer
4948
- */
4949
- connect(appkey: string, token: string, hosts: string[], protocol: 'http' | 'https', apiVersion: string, protocolVer: ConnAckProtocolVer): Promise<ErrorCode>;
4950
- /**
4951
- * 发起连接请求
4952
- */
4953
- private _connect;
4954
- /**
4955
- * 当前累计心跳超时次数
4956
- */
4957
- private _failedCount;
4958
- /**
4959
- * 允许连续 PING 超时次数,次数内不主动关闭连接
4960
- */
4961
- private readonly ALLOW_FAILED_TIMES;
4962
- /**
4963
- * ping定时器
4964
- */
4965
- private _timer;
4966
- private _checkAlive;
4967
- private _onReceiveSignal;
4968
- /**
4969
- * 只发送数据,无需响应
4970
- */
4971
- sendOnly(writer: BaseWriter): void;
4972
- /**
4973
- * 有效值 0 - 65535,超出 65535 位数超长溢出
4974
- */
4975
- private _idCount;
4976
- private _generateMessageId;
4977
- /**
4978
- * @param writer
4979
- * @param pbName 响应数据的 PB 定义
4980
- * @param timeout 超时配置,单位 ms
4981
- */
4982
- send<T>(writer: QueryWriter | PublishWriter, respPBName?: string, option?: any, timeout?: number): Promise<IAsyncRes<T>>;
4983
- /**
4984
- * 关闭数据通道,同时清空监听
4985
- */
4986
- close(): void;
4987
- }
4988
-
4989
4656
  declare type IMessageListnenr = (message: IReceivedMessage, leftCount?: number, hasMore?: boolean) => void;
4990
4657
  declare type IMessagesListnenr = (messages: IReceivedMessage[], leftCount?: number, hasMore?: boolean) => void;
4991
- declare type IConnectionStatusListener = (status: ConnectionStatus) => void;
4658
+ declare type IConnectionStatusListener = (status: RCConnectionStatus | ErrorCode | ConnectionStatus) => void;
4992
4659
  declare type IConversationStateListener = (conversation: IUpdatedConversation[]) => void;
4993
4660
  declare type IChatroomListener = (state: IChatroomListenerData) => void;
4994
4661
  declare type IRTCInnerListener = {
@@ -5005,12 +4672,18 @@ declare type IGroupMessageDeliveredStatusListener = (data: IGroupMessageDeliverS
5005
4672
  interface IWatcher {
5006
4673
  message?: IMessageListnenr;
5007
4674
  batchMessage?: IMessagesListnenr;
5008
- connectionState?: IConnectionStatusListener;
4675
+ /**
4676
+ * 连接状态变更监听
4677
+ * @param status 变更的连接状态
4678
+ * @param code 当连接状态为 `RCConnectionStatus.DISCONNECTED` 或 `RCConnectionStatus.SUSPEND` 时有值
4679
+ */
4680
+ connection?: (status: RCConnectionStatus, code?: ErrorCode) => void;
5009
4681
  conversationState?: IConversationStateListener;
5010
4682
  chatroomState?: IChatroomListener;
5011
4683
  expansion?: IExpansionListener;
5012
4684
  /**
5013
4685
  * 为兼容老版本 RTCLib 与 CallLib 接收消息的方式,新版本消息走插件机制
4686
+ * @deprecated
5014
4687
  */
5015
4688
  rtcInnerWatcher?: IRTCInnerListener;
5016
4689
  /**
@@ -5034,10 +4707,6 @@ interface IWatcher {
5034
4707
  * 群聊消息送达状态通知
5035
4708
  */
5036
4709
  groupMessageDeliveredStatus?: IGroupMessageDeliveredStatusListener;
5037
- onConnecting?: () => void;
5038
- onConnected?: () => void;
5039
- onDisconnect?: (status: ConnectionStatus) => void;
5040
- onSuspend?: (status: ConnectionStatus | ErrorCode) => void;
5041
4710
  readReceiptReceived?: (conversation: IConversationOption, messageUId: string, sentTime: number) => void;
5042
4711
  messageReceiptRequest?: (conversation: IConversationOption, messageUId: string, senderUserId: string) => void;
5043
4712
  messageReceiptResponse?: (conversation: IConversationOption, receivedUserId: string, messageUIdList: string[]) => void;
@@ -5059,10 +4728,6 @@ interface IAPIContextOption {
5059
4728
  * 应用 appkey
5060
4729
  */
5061
4730
  appkey: string;
5062
- /**
5063
- * IMLib 版本号
5064
- */
5065
- apiVersion: string;
5066
4731
  /**
5067
4732
  * 自定义导航地址:
5068
4733
  * 1. 私有云环境下该值为必填项
@@ -5082,10 +4747,6 @@ interface IAPIContextOption {
5082
4747
  * typing状态过期时间
5083
4748
  */
5084
4749
  typingExpireTime?: number;
5085
- /**
5086
- * 是否校验证书,默认为 true
5087
- */
5088
- checkCA?: boolean;
5089
4750
  /**
5090
4751
  * 开启后,SDK 内的 HTTP 请求将由 Electron 主进程内发送。
5091
4752
  * @since 5.6.0
@@ -5186,6 +4847,11 @@ declare class Codec<T> {
5186
4847
  * @param data 待解码数据
5187
4848
  */
5188
4849
  decode(pbname: string, uint8array: Uint8Array): any;
4850
+ /**
4851
+ * protobuf 结构中,int64 类型数据无法直接转为 JS 的 number 数据,需计算获取
4852
+ * @param data
4853
+ */
4854
+ private fixInt64Values;
5189
4855
  }
5190
4856
 
5191
4857
  declare class APIContext {
@@ -5203,19 +4869,10 @@ declare class APIContext {
5203
4869
  */
5204
4870
  private _pluginInstanseMap;
5205
4871
  private readonly _engine;
5206
- /**
5207
- * 核心库版本号,后期与 4.0 IM SDK 版本号保持一致
5208
- */
5209
- readonly coreVersion: string;
5210
4872
  readonly appkey: string;
5211
- readonly apiVersion: string;
5212
4873
  private readonly _options;
5213
4874
  private _versionInfo;
5214
4875
  private _typingInfo;
5215
- /**
5216
- * 内部连接状态标识,为 ture 时不允许调用 reconnect 方法
5217
- */
5218
- private _isInternalConnected;
5219
4876
  /**
5220
4877
  * RTC 相关的编解码模块,用于向前兼容 RTC 旧版本的编解码,
5221
4878
  * 包括向 CppEngine 提供 RTC 业务编解码能力
@@ -5233,21 +4890,23 @@ declare class APIContext {
5233
4890
  * @param options
5234
4891
  */
5235
4892
  install<T, O>(plugin: IPluginGenerator<T, O>, options: O): T | null;
5236
- private _connectionStatus;
5237
- private _canRedirectConnect;
4893
+ private _onConnectionStatusChange;
4894
+ private _processChatrormMessage;
4895
+ private _processChrmMemChangeMessage;
4896
+ private _processTypingStatusMessage;
4897
+ private _processInterceptMessage;
5238
4898
  /**
5239
- * 重定向后,递归调用 connect
5240
- */
5241
- private _handleRedirect;
4899
+ * 消息处理器(v2/v4/next 版本中兼容)
4900
+ * 返回 false | undefined:消息继续向上抛出,true:内部处理或转为事件回调,无需向上抛出
4901
+ */
4902
+ private _compatibleMessageProccessor;
4903
+ private _processReadReceiptMessage;
4904
+ private _processReadReceiptRequestMessage;
4905
+ private _processReadReceiptResponseMessage;
5242
4906
  /**
5243
- * 连接状态变更回调
5244
- * @param message
4907
+ * 消息处理器(imlib-next 中转为事件回调, 无需抛出)
5245
4908
  */
5246
- private _connectionStatusListener;
5247
- _handleConnecting(): void;
5248
- _handleConnected(): void;
5249
- _handleDisconnect(status: ConnectionStatus): void;
5250
- _handleSuspend(status: ConnectionStatus | ErrorCode): void;
4909
+ private _messageProccessor;
5251
4910
  private _messageReceiver;
5252
4911
  _batchMessageReceiver(messages: IReceivedMessage[], leftCount?: number, hasMore?: boolean): void;
5253
4912
  /**
@@ -5320,6 +4979,7 @@ declare class APIContext {
5320
4979
  getCurrentUserId(): string;
5321
4980
  getConnectionStatus(): ConnectionStatus;
5322
4981
  get token(): string;
4982
+ refetchNaviInfo(): IPromiseResult<INaviInfo | null>;
5323
4983
  /**
5324
4984
  * 建立连接,连接失败则抛出异常,连接成功后返回用户 userId,否则返回相应的错误码
5325
4985
  * @param token
@@ -5333,22 +4993,14 @@ declare class APIContext {
5333
4993
  这个字段就是为这种情况加的。
5334
4994
  设置 reconnectKickEnable 为 true 时,SDK 重连的时候发现此时已有别的设备连接成功,不再强行踢出已有设备,而是踢出重连设备。
5335
4995
  */
5336
- connect(token: string, refreshNavi?: boolean, reconnectKickEnable?: boolean, traceId?: string): Promise<IConnectResult>;
5337
- /**
5338
- * 拉取实时配置 web 端需更新 voipCall 字段
5339
- */
5340
- private _pullUserSettings;
4996
+ connect(token: string, reconnectKickEnable: boolean, traceId: string): Promise<IConnectResult>;
5341
4997
  disconnect(): Promise<void>;
5342
4998
  reconnect(reconnectKickEnable?: boolean): Promise<IConnectResult>;
5343
4999
  private _getTokenWithoutNavi;
5344
5000
  /**
5345
5001
  * 获取当前缓存的导航数据
5346
5002
  */
5347
- getInfoFromCache(): INaviInfo | null;
5348
- /**
5349
- * 请求服务导航数据
5350
- */
5351
- reqNaviInfo(refreshNavi: boolean, traceId?: string): IPromiseResult<INaviInfo | null>;
5003
+ getNaviInfoFromCache(): INaviInfo | null;
5352
5004
  private _registerMessageSearchPropsMapping;
5353
5005
  /**
5354
5006
  * 消息注册
@@ -5714,7 +5366,11 @@ declare class APIContext {
5714
5366
  /**
5715
5367
  * 获取所有本地置顶列表
5716
5368
  */
5717
- getTopConversationList(): Promise<IAsyncRes<IBaseConversationInfo[]>>;
5369
+ getTopConversationList(conversationTypes?: ConversationType[], channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
5370
+ /**
5371
+ * 获取未读会话列表
5372
+ */
5373
+ getUnreadConversationList(conversationTypes?: ConversationType[]): Promise<IAsyncRes<IReceivedConversation[]>>;
5718
5374
  getUnreadMentionedCount(conversation: IConversationOption): Promise<IAsyncRes<number>>;
5719
5375
  /**
5720
5376
  * 获取所有群聊会话 @ 消息未读数
@@ -5849,7 +5505,7 @@ declare class APIContext {
5849
5505
  /**
5850
5506
  * 获取本地消息
5851
5507
  */
5852
- getMessage(messageId: number): Promise<IAsyncRes<IReceivedMessage>>;
5508
+ getMessage(messageId: number | string): Promise<IAsyncRes<IReceivedMessage>>;
5853
5509
  /**
5854
5510
  * 设置消息内容
5855
5511
  */
@@ -6003,20 +5659,32 @@ declare class APIContext {
6003
5659
  * SDK设置聊天室关联的rtc房间
6004
5660
  */
6005
5661
  bindRTCRoomForChatroom(option: IRTCRoomBindOption): Promise<ErrorCode>;
5662
+ /**
5663
+ * 设置代理
5664
+ */
5665
+ setProxy(proxy: IProxy | null): IPromiseResult<IProxy>;
5666
+ /**
5667
+ * 获取代理
5668
+ */
5669
+ getProxy(): IPromiseResult<IProxy>;
5670
+ /**
5671
+ * 测试代理
5672
+ */
5673
+ testProxy(proxy: IProxy, testHost: string): Promise<IResponse>;
6006
5674
  }
6007
5675
 
6008
5676
  declare class PluginContext {
6009
5677
  protected readonly _context: APIContext;
6010
5678
  constructor(_context: APIContext);
6011
- /**
6012
- * 重新请求服务导航数据
6013
- */
6014
- refetchNaviInfo(): IPromiseResult<INaviInfo | null>;
6015
5679
  /**
6016
5680
  * 获取 context
6017
5681
  */
6018
5682
  __getContext(): APIContext;
6019
5683
  createCodec<T extends CodecPBMaps>(keymaps: T, pbDesc: string): Codec<T>;
5684
+ /**
5685
+ * 重新请求服务导航数据
5686
+ */
5687
+ refetchNaviInfo(): IPromiseResult<INaviInfo | null>;
6020
5688
  /**
6021
5689
  * 获取当前的导航数据
6022
5690
  */
@@ -6035,9 +5703,10 @@ declare class PluginContext {
6035
5703
  onnavidatachange?(naviInfo: INaviInfo): void;
6036
5704
  /**
6037
5705
  * 接收 IM 连接状态变更通知
6038
- * @param status
5706
+ * @param status 当前连接状态,ConnectionStatus 仅作为向前兼容声明,实际通知只有 RCConnectionStatus 值
5707
+ * @param code 当连接状态为 `RCConnectionStatus.DISCONNECTED` 或 `RCConnectionStatus.SUSPEND` 时有值
6039
5708
  */
6040
- onconnectionstatechange?(status: ConnectionStatus): void;
5709
+ onconnectionstatechange?(status: RCConnectionStatus | ConnectionStatus, code?: ErrorCode): void;
6041
5710
  /**
6042
5711
  * IM 客户端销毁通知
6043
5712
  */
@@ -6314,14 +5983,13 @@ declare const keymaps: CodecPBMaps;
6314
5983
  */
6315
5984
  declare type RTCKeyMaps = typeof keymaps;
6316
5985
 
6317
- interface IEngineWatcher {
5986
+ interface IEngineWatcher extends IConnectionListener {
6318
5987
  /**
6319
5988
  * @param message 消息
6320
5989
  * @param leftCount 参数废弃,值始终为 undefined
6321
5990
  * @param hasMore 消息是否收取结束,需与协议栈配合使用
6322
5991
  */
6323
5992
  batchMessage: (messages: IReceivedMessage[], leftCount?: number, hasMore?: boolean) => void;
6324
- status: (status: ConnectionStatus) => void;
6325
5993
  chatroom: (event: IChatroomListenerData) => void;
6326
5994
  conversation: (event: any) => void;
6327
5995
  expansion: (event: IExpansionListenerData) => void;
@@ -6348,7 +6016,7 @@ interface IEngineWatcher {
6348
6016
  /**
6349
6017
  * 引擎定义
6350
6018
  */
6351
- declare abstract class AEngine implements IEngine {
6019
+ declare abstract class AEngine {
6352
6020
  readonly runtime: IRuntime;
6353
6021
  readonly rtcCodec: Codec<RTCKeyMaps>;
6354
6022
  protected readonly _watcher: IEngineWatcher;
@@ -6359,8 +6027,6 @@ declare abstract class AEngine implements IEngine {
6359
6027
  */
6360
6028
  abstract getConnectedTime(): number;
6361
6029
  protected readonly _appkey: string;
6362
- protected readonly _apiVer: string;
6363
- protected readonly _apiVersion: string;
6364
6030
  private _rtcKVManager;
6365
6031
  /**
6366
6032
  * 引擎初始化
@@ -6373,28 +6039,22 @@ declare abstract class AEngine implements IEngine {
6373
6039
  * @param listener
6374
6040
  */
6375
6041
  registerRTCSignalingListener(listener: ((buffer: Uint8Array) => void) | undefined): void;
6376
- abstract requestNaviInfo(uris: string[], appkey: string, token: string, checkCA?: boolean): Promise<INaviInfo | null>;
6377
6042
  /**
6378
- * 为非 engine 包创建 logger 工具实例
6043
+ * 忽视缓存,重新请求导航数据
6379
6044
  */
6380
- abstract createLogger(id: string, type: LogType): BasicLogger;
6045
+ abstract refetchNaviInfo(): IPromiseResult<INaviInfo | null>;
6381
6046
  /**
6382
- * 获取 engine 包内部 logger 工具
6047
+ * 获取导航缓存数据
6383
6048
  */
6384
- getInnerLogger(): BasicLogger;
6049
+ abstract getNaviInfoFromCache(): INaviInfo | null;
6385
6050
  /**
6386
- * 获取导航数据
6387
- * @param token
6388
- * @param dynamicUris token 携带的动态导航地址
6389
- * @param force 是否强制重新获取并清空缓存数据
6051
+ * 为非 engine 包创建 logger 工具实例
6390
6052
  */
6391
- getNaviInfo(token: string, dynamicUris: string[], force: boolean, checkCA?: boolean): Promise<INaviInfo | null>;
6392
- protected setNaviInfo2Cache(token: string, naviInfo: INaviInfo): void;
6393
- abstract getNaviInfoFromCache(): INaviInfo | null;
6053
+ abstract createLogger(id: string, type: LogType): BasicLogger;
6394
6054
  /**
6395
- * 清空导航数据:内存数据、缓存数据
6055
+ * 获取 engine 包内部 logger 工具
6396
6056
  */
6397
- private _clear;
6057
+ getInnerLogger(): BasicLogger;
6398
6058
  /**
6399
6059
  * 调用非标准方法。所谓非标准方法,是为某些特定需求或产品添加,暂未作为标准接口添加至 API 层。
6400
6060
  * 对于未实现的方法,接口响应 Unsupport 错误码
@@ -6405,10 +6065,10 @@ declare abstract class AEngine implements IEngine {
6405
6065
  /**
6406
6066
  * 建立连接
6407
6067
  * @param token
6408
- * @param naviInfo
6409
6068
  * @param reconnectKickEnable
6069
+ * @param traceId
6410
6070
  */
6411
- abstract connect(token: string, naviInfo: INaviInfo, reconnectKickEnable?: boolean, traceId?: string): Promise<ErrorCode>;
6071
+ abstract connect(token: string, reconnectKickEnable: boolean, traceId: string): IPromiseResult<string>;
6412
6072
  /**
6413
6073
  * 发送SDK版本
6414
6074
  * @param versionInfo
@@ -6518,6 +6178,10 @@ declare abstract class AEngine implements IEngine {
6518
6178
  * 获取指定会话
6519
6179
  */
6520
6180
  abstract getConversation(conversationType: ConversationType, targetId: string, channelId: string): IPromiseResult<IReceivedConversation | null>;
6181
+ /**
6182
+ * 获取未读会话列表
6183
+ */
6184
+ abstract getUnreadConversationList(conversationTypes: ConversationType[]): IPromiseResult<IReceivedConversation[]>;
6521
6185
  /**
6522
6186
  * 删除会话
6523
6187
  * @description 该删除操作会删除服务器端存储的会话数据
@@ -6594,11 +6258,15 @@ declare abstract class AEngine implements IEngine {
6594
6258
  /**
6595
6259
  * 断开连接
6596
6260
  */
6597
- abstract disconnect(): void;
6261
+ abstract disconnect(): Promise<void>;
6598
6262
  /**
6599
6263
  * 拉取用户级配置数据
6600
6264
  */
6601
6265
  abstract pullUserSettings(version: number): IPromiseResult<IServerUserSetting>;
6266
+ /**
6267
+ * 获取当前连接状态
6268
+ */
6269
+ abstract getConnectionStatus(): RCConnectionStatus;
6602
6270
  /**
6603
6271
  * 消息注册
6604
6272
  * @description
@@ -6909,7 +6577,7 @@ declare abstract class AEngine implements IEngine {
6909
6577
  /**
6910
6578
  * 获取消息
6911
6579
  */
6912
- abstract getMessage(messageId: number): IPromiseResult<IReceivedMessage>;
6580
+ abstract getMessage(messageId: number | string): IPromiseResult<IReceivedMessage>;
6913
6581
  /**
6914
6582
  * 设置消息内容
6915
6583
  */
@@ -7014,7 +6682,7 @@ declare abstract class AEngine implements IEngine {
7014
6682
  /**
7015
6683
  * 无差别获取本地置顶列表
7016
6684
  */
7017
- abstract getTopConversationList(): Promise<IAsyncRes<IBaseConversationInfo[]>>;
6685
+ abstract getTopConversationList(conversationTypes: ConversationType[], channelId?: string): Promise<IAsyncRes<IReceivedConversation[]>>;
7018
6686
  /**
7019
6687
  * 获取单个群聊会话 @ 消息未读数
7020
6688
  */
@@ -7118,6 +6786,18 @@ declare abstract class AEngine implements IEngine {
7118
6786
  * Engine 反初始化
7119
6787
  */
7120
6788
  destroy(): void;
6789
+ /**
6790
+ * 设置代理
6791
+ */
6792
+ abstract setProxy(proxy: IProxy | null): IPromiseResult<IProxy>;
6793
+ /**
6794
+ * 获取代理
6795
+ */
6796
+ abstract getProxy(): IPromiseResult<IProxy>;
6797
+ /**
6798
+ * 测试代理
6799
+ */
6800
+ abstract testProxy(proxy: IProxy, testHost: string): Promise<IResponse>;
7121
6801
  }
7122
6802
 
7123
6803
  declare class AppStorage {
@@ -7262,6 +6942,7 @@ declare const notEmptyObject: (val: Object) => boolean;
7262
6942
  declare const isValidConversationType: (conversation: number) => boolean;
7263
6943
  declare const isValidNotificationLevel: (level: number) => boolean;
7264
6944
  declare const isValidChannelId: (value: any) => boolean;
6945
+ declare const isTypeInConversationList: (type: number) => boolean;
7265
6946
  /**
7266
6947
  * 判断是否是一个有效的文件类型
7267
6948
  */
@@ -7292,31 +6973,31 @@ declare function ID(): string;
7292
6973
  /**
7293
6974
  * @deprecated
7294
6975
  */
7295
- declare function init(userLogInfo: ILogInit): void;
6976
+ declare function init(userLogInfo: any): void;
7296
6977
  /**
7297
6978
  * @deprecated
7298
6979
  */
7299
- declare function log(logLevel: LogLevel, tagId: LogTagId | string, logObj?: Object, logExtens?: ILogExtensions): void;
6980
+ declare function log(logLevel: LogLevel, tagId: LogTagId | string, logObj?: Object, logExtens?: any): void;
7300
6981
  /**
7301
6982
  * @deprecated
7302
6983
  */
7303
- declare const debug: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6984
+ declare const debug: (tagId: string, logObj?: Object | undefined, logExtens?: any) => void;
7304
6985
  /**
7305
6986
  * @deprecated
7306
6987
  */
7307
- declare const info: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6988
+ declare const info: (tagId: string, logObj?: Object | undefined, logExtens?: any) => void;
7308
6989
  /**
7309
6990
  * @deprecated
7310
6991
  */
7311
- declare const warn: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6992
+ declare const warn: (tagId: string, logObj?: Object | undefined, logExtens?: any) => void;
7312
6993
  /**
7313
6994
  * @deprecated
7314
6995
  */
7315
- declare const error: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
6996
+ declare const error: (tagId: string, logObj?: Object | undefined, logExtens?: any) => void;
7316
6997
  /**
7317
6998
  * @deprecated
7318
6999
  */
7319
- declare const fatal: (tagId: string, logObj?: Object | undefined, logExtens?: ILogExtensions | undefined) => void;
7000
+ declare const fatal: (tagId: string, logObj?: Object | undefined, logExtens?: any) => void;
7320
7001
 
7321
7002
  declare const base_logLevelTransformer: typeof logLevelTransformer;
7322
7003
  declare const base_ID: typeof ID;
@@ -7553,11 +7234,6 @@ declare const getBrowser: (runtime: IRuntime) => {
7553
7234
  type: any;
7554
7235
  version: any;
7555
7236
  };
7556
- /**
7557
- * 将连接时服务端返回码转换成业务响应码
7558
- * @param code 连接响应码
7559
- */
7560
- declare const formatConnectResponseCode: (code: number) => ErrorCode;
7561
7237
  declare const clone: (target: any) => any;
7562
7238
 
7563
7239
  /**
@@ -7647,6 +7323,12 @@ declare const DB_LOG_FLUSH_FREQUENCY = 3000;
7647
7323
  declare const ONE_LOG_SIZE_MAX = 1000;
7648
7324
  /** 日志上报域名 */
7649
7325
  declare const LOG_REPORT_URI = "logcollection.ronghub.com";
7326
+ /** SDK 版本号 */
7327
+ declare const VERSION: string;
7328
+ /**
7329
+ * 祛除标签的标准版本号,如愿版本号为 `3.1.0-alpha.1`,则该值为 `3.1.0`
7330
+ */
7331
+ declare const FORMATED_VERSION: string;
7650
7332
 
7651
7333
  /**
7652
7334
  * 请使用 `Codec` 替代 `AbsCodec`
@@ -7655,8 +7337,9 @@ declare const LOG_REPORT_URI = "logcollection.ronghub.com";
7655
7337
  declare type AbsCodec<T> = Codec<T>;
7656
7338
 
7657
7339
  /**
7340
+ * @deprecated
7658
7341
  * engine 版本号
7659
7342
  */
7660
7343
  declare const version: string;
7661
7344
 
7662
- export { AEngine, APIContext, AbsCodec, AppStorage, AssertRules, BasicLogger, BasicReporter, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, ChatroomUserChangeType, Codec, CodecPBMaps, ConnectResultCode, ConnectionStatus, ConversationType, DB_LOG_FLUSH_FREQUENCY, DB_LOG_MAX_SIZE, DelayTimer, EnableLogL, ErrorCode, EventEmitter, FileType, HTTP_TIMEOUT, HttpMethod, IAPIContextOption, IAndroidPushConfig, IAsyncRes, IBaseConversationInfo, IBigdataLogInit, IBlockedMessageInfo, ICancelRoomPKOptions, IChatRoomEntries, IChatRoomEntry, IChatroomEntries, IChatroomEntry, IChatroomEntryListenerData, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChatroomRejoinedFailed, IChatroomRejoinedInfo, IChatroomRejoinedSuccessed, IChatroomUser, IChatroomUserChangeInfo, IChrmKVEntries, IChrmKVEntry, IConnectResult, IConnectionStatusListener, IConversationOption, IConversationState, IConversationStateListener, IConversationTag, IConversationTagListener, IDeletedExpansion, IDeliveredUser, IEndRoomPKOptions, IEngine, IEngineWatcher, IEventListener, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IGetMsgOption, IGetUltraGroupListOption, IGooglePushConfig, IGroupMessageDeliverInfo, IGroupMessageDeliverStatus, IInitBigDataOption, IInsertMsgOptions, IIsValidExpansion, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, ILogDB, ILogData, ILogExtensions, ILogInfo, ILogInit, ILogger, IM_CHATROOM_PULL_INTERVAL_TIME, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageDeliver, IMessageDeliveredListener, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviInfo, IOSInfo, IOperateStatusNotify, IPluginGenerator, IProcessInfo, IPromiseResult, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomBindOption, IRTCRoomInfo, IRTCUserData, IRTCUsers, IReadReceiptInfo, IRealTimeLog, IRecallMsgContent, 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, IUltraChannelChangeInfo, IUltraChannelDeleteInfo, IUltraChannelUserKickedInfo, IUltraExMsgOptions, IUltraGroupConversation, IUltraGroupOption, IUltraGroupUnreadMentionedOption, IUltraModifyMsgOptions, IUltraMsgQueryOptions, IUltraUnreadConversation, IUltraUnreadMsg, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserProfile, IWatcher, IWebSocket, IiOSPushConfig, IndexDBLogger, IndexDBReporter, RTCKeyMaps as InnerRTCKeyMaps, ItypingStateListener, KVString, LOG_REPORT_URI, LiveRole, LiveType, LogContent, LogL, LogLevel, LogSource, LogTagId, LogType, Logger, MAX_MESSAGE_CONTENT_BYTES, MAX_MESSAGE_EXPANSION_KEY_LENGTH, MAX_MESSAGE_EXPANSION_VAL_LENGTH, MINI_SOCKET_CONNECT_URIS, MentionedType, MessageBlockSourceType, MessageBlockType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NetworkType, NotificationLevel, NotificationStatus, ONE_LOG_SIZE_MAX, OperateStatus, PUBLIC_CLOUD_NAVI_URIS, PluginContext, RCAssertError, REAT_TIME_LOG_SIZE, RTCApiType, RTCIdentityChangeType, RTCJoinType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATUS_MESSAGE, STORAGE_ROOT_KEY, StoreKeys, TagChangeType, UltraGroupChannelChangeType, UltraGroupChannelType, UltraMsgChangeType, UltraMsgSubChangeType, UploadMethod, VersionManage, WEB_SOCKET_TIMEOUT, WebSocketChannel, appendUrl, assert, clone, cloneByJSON, deInitLogDB, logger as engineLogger, forEach, formatConnectResponseCode, getBrowser, getClientMessageId, getMimeKey, getUUID, getUUID22, getUploadFileName, indexOf, initLogDB, isArray, isArrayBuffer, isBoolean, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isUndefined, isValidChannelId, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidExpansion, isValidFileType, isValidNotificationLevel, base as logger, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, transcsv, usingCppEngine, validate, version };
7345
+ export { AConnectionMgr, AEngine, APIContext, AbsCodec, AppStorage, AssertRules, BasicLogger, BasicNavi, BasicReporter, CPP_PROTOCAL_MSGTYPE_OPTION, CallLibMsgType, ChatroomEntryType, ChatroomUserChangeType, Codec, CodecPBMaps, ConnectionStatus, ConversationType, DB_LOG_FLUSH_FREQUENCY, DB_LOG_MAX_SIZE, DelayTimer, EnableLogL, ErrorCode, EventEmitter, FORMATED_VERSION, FileType, HTTP_TIMEOUT, HttpMethod, IAPIContextOption, IAndroidPushConfig, IAsyncRes, IBaseConversationInfo, IBlockedMessageInfo, ICancelRoomPKOptions, IChatRoomEntries, IChatRoomEntry, IChatroomEntries, IChatroomEntry, IChatroomEntryListenerData, IChatroomInfo, IChatroomListener, IChatroomListenerData, IChatroomRejoinedFailed, IChatroomRejoinedInfo, IChatroomRejoinedSuccessed, IChatroomUser, IChatroomUserChangeInfo, IChrmKVEntries, IChrmKVEntry, IConnectResult, IConnectionListener, IConnectionStatusListener, IConversationOption, IConversationState, IConversationStateListener, IConversationTag, IConversationTagListener, IDeletedExpansion, IDeliveredUser, IEndRoomPKOptions, IEngine, IEngineWatcher, IEventListener, IExpansionListener, IExpansionListenerData, IExpansionMsgContent, IExtraMethod, IGetMsgOption, IGetUltraGroupListOption, IGooglePushConfig, IGroupMessageDeliverInfo, IGroupMessageDeliverStatus, IGroupMessageDeliveredStatusInfo, IInsertMsgOptions, IIsValidExpansion, IJoinRTCRoomData, ILocalReadReceiptInfo, ILocalTagStatus, ILogDB, ILogData, ILogger, IM_CHATROOM_PULL_INTERVAL_TIME, IM_PING_INTERVAL_TIME, IM_PING_MIN_TIMEOUT, IM_PING_TIMEOUT, IM_SIGNAL_TIMEOUT, IMessageDeliver, IMessageDeliveredListener, IMessageListnenr, IMessageReader, IMessageReaderResponse, IMetionedData, INaviCache, INaviInfo, IOSInfo, IOperateInfo, IOperateStatusNotify, IOperateSummary, IPluginGenerator, IProcessCache, IProcessInfo, IPromiseResult, IProxy, IPushConfig, IRTCInnerListener, IRTCJoinedInfo, IRTCRoomBindOption, IRTCRoomInfo, IRTCUserData, IRTCUsers, IReadReceiptInfo, IRecallMsgContent, 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, IUltraChannelChangeInfo, IUltraChannelDeleteInfo, IUltraChannelUserKickedInfo, IUltraExMsgOptions, IUltraGroupConversation, IUltraGroupOption, IUltraGroupUnreadMentionedOption, IUltraModifyMsgOptions, IUltraMsgQueryOptions, IUltraUnreadConversation, IUltraUnreadMsg, IUpdatedConversation, IUpdatedExpansion, IUploadAuth, IUserProfile, IWatcher, IWebSocket, IiOSPushConfig, IndexDBLogger, IndexDBReporter, RTCKeyMaps as InnerRTCKeyMaps, ItypingStateListener, KVString, LOG_REPORT_URI, LiveRole, LiveType, LogContent, LogL, LogLevel, LogSource, LogTagId, LogType, Logger, MAX_MESSAGE_CONTENT_BYTES, MAX_MESSAGE_EXPANSION_KEY_LENGTH, MAX_MESSAGE_EXPANSION_VAL_LENGTH, MINI_SOCKET_CONNECT_URIS, MentionedType, MessageBlockSourceType, MessageBlockType, MessageDirection, MessageType, NAVI_CACHE_DURATION, NAVI_REQ_TIMEOUT, NetworkType, NotificationLevel, NotificationStatus, ONE_LOG_SIZE_MAX, OperateStatus, PUBLIC_CLOUD_NAVI_URIS, PluginContext, RCAssertError, RCConnectionStatus, REAT_TIME_LOG_SIZE, RTCApiType, RTCIdentityChangeType, RTCJoinType, RTCMode, RTCPluginContext, ReceivedStatus, SEND_MESSAGE_TYPE_OPTION, STATUS_MESSAGE, STORAGE_ROOT_KEY, StoreKeys, TagChangeType, UltraGroupChannelChangeType, UltraGroupChannelType, UltraMsgChangeType, UltraMsgSubChangeType, UploadMethod, VERSION, VersionManage, WEB_SOCKET_TIMEOUT, WebSocketNavi, appendUrl, assert, clone, cloneByJSON, deInitLogDB, logger as engineLogger, forEach, getBrowser, getClientMessageId, getMimeKey, getUUID, getUUID22, getUploadFileName, indexOf, initLogDB, isArray, isArrayBuffer, isBoolean, isConnnectAckCode as isConnnectAck, isDisconnectCode as isDisconnectedByServer, isFunction, isHttpUrl, isInObject, isInclude, isNull, isNumber, isObject, isString, isTypeInConversationList, isUndefined, isValidChannelId, isValidChrmEntryKey, isValidChrmEntryValue, isValidConversationType, isValidExpansion, isValidFileType, isValidNotificationLevel, base as logger, map, notEmptyArray, notEmptyObject, notEmptyString, pushConfigsToJSON, pushJSONToConfigs, todo, transcsv, usingCppEngine, validate, version };