alivc-im.iife.d.ts 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515
  1. declare namespace AliVCInteraction {
  2. class AliVCIMAttachmentManager {
  3. private static instance;
  4. private wasmIns;
  5. private attachmentManager;
  6. private uploader;
  7. constructor(wasmIns: any, wasmInterface: any);
  8. static getInstance(wasmIns: any, wasmInterface: any): AliVCIMAttachmentManager;
  9. getAttachmentReq(attachmentReq: ImAttachmentReq): Promise<any>;
  10. /**
  11. * 上传附件
  12. * @param {string} reqId
  13. * @param {ImAttachmentReq} attachmentReq
  14. * @returns {ImAttachmentRes}
  15. */
  16. uploadAttachment(reqId: string, attachmentReq: ImAttachmentReq): Promise<ImAttachmentRes>;
  17. /**
  18. * 取消上传附件
  19. * @param {string} reqId
  20. * @returns
  21. */
  22. cancelAttachmentUpload(reqId: string): Promise<void>;
  23. /**
  24. * 删除已上传附件
  25. * @param {ImAttachmentRes} attachment
  26. * @returns
  27. */
  28. deleteAttachment(attachment: ImAttachmentRes): Promise<void>;
  29. destroy(): void;
  30. }
  31. class AliVCIMGroupManager extends EventEmitter<ImGroupListener> {
  32. private wasmIns;
  33. private wasmGroupManager;
  34. private groupListener;
  35. constructor(wasmIns: any, wasmInterface: any);
  36. addGroupListener(): void;
  37. removeGroupListener(): void;
  38. destroy(): void;
  39. /**
  40. * 创建群组,限管理员才能操作
  41. * @param {ImCreateGroupReq} req
  42. * @returns {Promise<ImCreateGroupRsp>}
  43. */
  44. createGroup(req: ImCreateGroupReq): Promise<ImCreateGroupRsp>;
  45. /**
  46. * 查询群组信息
  47. * @param {string | ImQueryGroupReq} groupIdOrReq
  48. * @returns {Promise<ImGroupInfo>}
  49. */
  50. queryGroup(groupIdOrReq: string | ImQueryGroupReq): Promise<ImGroupInfo>;
  51. /**
  52. * 关闭群组,限管理员才能操作
  53. * @param {string | ImCloseGroupReq} groupIdOrReq
  54. * @returns {Promise<void>}
  55. */
  56. closeGroup(groupIdOrReq: string | ImCloseGroupReq): Promise<void>;
  57. /**
  58. * 加入群组
  59. * @param {string | ImJoinGroupReq} groupIdOrReq
  60. * @returns {Promise<ImGroupInfo>}
  61. */
  62. joinGroup(groupIdOrReq: string | ImJoinGroupReq): Promise<ImGroupInfo>;
  63. /**
  64. * 离开群组
  65. * @param {string | ImLeaveGroupReq} groupIdOrReq
  66. * @returns {Promise<void>}
  67. */
  68. leaveGroup(groupIdOrReq: string | ImLeaveGroupReq): Promise<void>;
  69. /**
  70. * 修改群组信息
  71. * @param {ImModifyGroupReq} req
  72. * @returns {Promise<void>}
  73. */
  74. modifyGroup(req: ImModifyGroupReq): Promise<void>;
  75. /**
  76. * 查询最近组成员
  77. * @param {string | ImListRecentGroupUserReq} groupIdOrReq
  78. * @returns {Promise<ImListRecentGroupUserRsp>}
  79. */
  80. listRecentGroupUser(groupIdOrReq: string | ImListRecentGroupUserReq): Promise<ImListRecentGroupUserRsp>;
  81. /**
  82. * 查询群组成员,限管理员才能操作
  83. * @param {string | ImListGroupUserReq} groupIdOrReq
  84. * @returns {Promise<ImListGroupUserRsp>}
  85. */
  86. listGroupUser(groupIdOrReq: string | ImListGroupUserReq): Promise<ImListGroupUserRsp>;
  87. /**
  88. * 全体禁言,限管理员才能操作
  89. * @param {string | ImMuteAllReq} groupIdOrReq
  90. * @returns {Promise<void>}
  91. */
  92. muteAll(groupIdOrReq: string | ImMuteAllReq): Promise<void>;
  93. /**
  94. * 取消全体禁言,限管理员才能操作
  95. * @param {string | ImCancelMuteAllReq} groupIdOrReq
  96. * @returns {Promise<void>}
  97. */
  98. cancelMuteAll(groupIdOrReq: string | ImCancelMuteAllReq): Promise<void>;
  99. /**
  100. * 禁言指定用户,限管理员才能操作
  101. * @param {ImMuteUserReq} req
  102. * @returns {Promise<void>}
  103. */
  104. muteUser(req: ImMuteUserReq): Promise<void>;
  105. /**
  106. * 取消禁言指定用户,限管理员才能操作
  107. * @param {ImCancelMuteUserReq} req
  108. * @returns {Promise<void>}
  109. */
  110. cancelMuteUser(req: ImCancelMuteUserReq): Promise<void>;
  111. /**
  112. * 查询禁言用户列表,限管理员才能操作
  113. * @param {string | ImListMuteUsersReq} groupIdOrReq
  114. * @returns {Promise<ImListMuteUsersRsp>}
  115. */
  116. listMuteUsers(groupIdOrReq: string | ImListMuteUsersReq): Promise<ImListMuteUsersRsp>;
  117. }
  118. class AliVCIMMessageManager extends EventEmitter<ImMessageListener> {
  119. private wasmIns;
  120. private wasmMessageManager;
  121. private messageListener;
  122. private streamMessageManager;
  123. constructor(wasmIns: any, wasmInterface: any);
  124. addMessageListener(): void;
  125. removeMessageListener(): void;
  126. destroy(): void;
  127. /**
  128. * 发送单聊普通消息
  129. * @param {ImSendMessageToUserReq} req
  130. * @returns {string} messageId
  131. */
  132. sendC2cMessage(req: ImSendMessageToUserReq): Promise<string>;
  133. /**
  134. * 发送群聊普通消息
  135. * @param {ImSendMessageToGroupReq} req
  136. * @returns {string} messageId
  137. */
  138. sendGroupMessage(req: ImSendMessageToGroupReq): Promise<string>;
  139. /**
  140. * 查询消息列表
  141. * @param {ImListMessageReq} req
  142. * @returns {ImListMessageRsp}
  143. */
  144. listMessage(req: ImListMessageReq): Promise<ImListMessageRsp>;
  145. /**
  146. * 查询最近消息
  147. * @param {string |ImListRecentMessageReq} groupIdOrReq
  148. * @returns {ImListRecentMessageRsp}
  149. */
  150. listRecentMessage(groupIdOrReq: string | ImListRecentMessageReq): Promise<ImListRecentMessageRsp>;
  151. /**
  152. * 查询历史消息,该接口主要用户直播结束后的历史消息回放,用户无需进入群组可查询,比较耗时,在直播过程中不建议使用,另外该接口后续可能会收费。
  153. * @param {ImListHistoryMessageReq} req
  154. * @returns {ImListHistoryMessageRsp}
  155. */
  156. listHistoryMessage(req: ImListHistoryMessageReq): Promise<ImListHistoryMessageRsp>;
  157. /**
  158. * 删除/撤回群消息
  159. */
  160. deleteMessage(req: ImDeleteMessageReq): Promise<void>;
  161. /**
  162. * 创建流式消息
  163. */
  164. createStreamMessage(req: ImCreateStreamMessageReq): Promise<ImStreamMessageSender>;
  165. /**
  166. * 拒收流式消息
  167. */
  168. rejectStreamMessage(req: ImRejectStreamMessageReq): Promise<void>;
  169. /**
  170. * 自定义流式消息转发
  171. */
  172. forwardCustomMessage(req: ImForwardCustomMessageReq): Promise<ImForwardCustomMessageRsp>;
  173. }
  174. /**
  175. * Minimal `EventEmitter` interface that is molded against the Node.js
  176. * `EventEmitter` interface.
  177. */
  178. class EventEmitter<
  179. EventTypes extends EventEmitter.ValidEventTypes = string | symbol,
  180. Context extends any = any
  181. > {
  182. static prefixed: string | boolean;
  183. /**
  184. * Return an array listing the events for which the emitter has registered
  185. * listeners.
  186. */
  187. eventNames(): Array<EventEmitter.EventNames<EventTypes>>;
  188. /**
  189. * Return the listeners registered for a given event.
  190. */
  191. listeners<T extends EventEmitter.EventNames<EventTypes>>(
  192. event: T
  193. ): Array<EventEmitter.EventListener<EventTypes, T>>;
  194. /**
  195. * Return the number of listeners listening to a given event.
  196. */
  197. listenerCount(event: EventEmitter.EventNames<EventTypes>): number;
  198. /**
  199. * Calls each of the listeners registered for a given event.
  200. */
  201. emit<T extends EventEmitter.EventNames<EventTypes>>(
  202. event: T,
  203. ...args: EventEmitter.EventArgs<EventTypes, T>
  204. ): boolean;
  205. /**
  206. * Add a listener for a given event.
  207. */
  208. on<T extends EventEmitter.EventNames<EventTypes>>(
  209. event: T,
  210. fn: EventEmitter.EventListener<EventTypes, T>,
  211. context?: Context
  212. ): this;
  213. addListener<T extends EventEmitter.EventNames<EventTypes>>(
  214. event: T,
  215. fn: EventEmitter.EventListener<EventTypes, T>,
  216. context?: Context
  217. ): this;
  218. /**
  219. * Add a one-time listener for a given event.
  220. */
  221. once<T extends EventEmitter.EventNames<EventTypes>>(
  222. event: T,
  223. fn: EventEmitter.EventListener<EventTypes, T>,
  224. context?: Context
  225. ): this;
  226. /**
  227. * Remove the listeners of a given event.
  228. */
  229. removeListener<T extends EventEmitter.EventNames<EventTypes>>(
  230. event: T,
  231. fn?: EventEmitter.EventListener<EventTypes, T>,
  232. context?: Context,
  233. once?: boolean
  234. ): this;
  235. off<T extends EventEmitter.EventNames<EventTypes>>(
  236. event: T,
  237. fn?: EventEmitter.EventListener<EventTypes, T>,
  238. context?: Context,
  239. once?: boolean
  240. ): this;
  241. /**
  242. * Remove all listeners, or those of the specified event.
  243. */
  244. removeAllListeners(event?: EventEmitter.EventNames<EventTypes>): this;
  245. }
  246. namespace EventEmitter {
  247. interface ListenerFn<Args extends any[] = any[]> {
  248. (...args: Args): void;
  249. }
  250. interface EventEmitterStatic {
  251. new <
  252. EventTypes extends ValidEventTypes = string | symbol,
  253. Context = any
  254. >(): EventEmitter<EventTypes, Context>;
  255. }
  256. /**
  257. * `object` should be in either of the following forms:
  258. * ```
  259. * interface EventTypes {
  260. * 'event-with-parameters': any[]
  261. * 'event-with-example-handler': (...args: any[]) => void
  262. * }
  263. * ```
  264. */
  265. type ValidEventTypes = string | symbol | object;
  266. type EventNames<T extends ValidEventTypes> = T extends string | symbol
  267. ? T
  268. : keyof T;
  269. type ArgumentMap<T extends object> = {
  270. [K in keyof T]: T[K] extends (...args: any[]) => void
  271. ? Parameters<T[K]>
  272. : T[K] extends any[]
  273. ? T[K]
  274. : any[];
  275. };
  276. type EventListener<
  277. T extends ValidEventTypes,
  278. K extends EventNames<T>
  279. > = T extends string | symbol
  280. ? (...args: any[]) => void
  281. : (
  282. ...args: ArgumentMap<Exclude<T, string | symbol>>[Extract<K, keyof T>]
  283. ) => void;
  284. type EventArgs<
  285. T extends ValidEventTypes,
  286. K extends EventNames<T>
  287. > = Parameters<EventListener<T, K>>;
  288. const EventEmitter: EventEmitterStatic;
  289. }
  290. interface ImAttachmentProgress {
  291. progress: number;
  292. totalSize: number;
  293. currentSize: number;
  294. }
  295. interface ImAttachmentReq {
  296. id: string;
  297. fileType: ImAttachmentType;
  298. fileName: string;
  299. file?: File | Blob;
  300. filePath?: string;
  301. extra?: string;
  302. onProgress?: (res: ImAttachmentProgress) => void;
  303. }
  304. interface ImAttachmentRes {
  305. id: string;
  306. fileType: ImAttachmentType;
  307. fileSize: number;
  308. fileName: string;
  309. accessKey: string;
  310. fileDuration: number;
  311. extra: string;
  312. }
  313. enum ImAttachmentType {
  314. IMAGE = 1,
  315. AUDIO = 2,
  316. VIDEO = 3,
  317. OTHER = 4
  318. }
  319. interface ImAuth {
  320. /**
  321. * 随机数,格式:"AK-随机串", 最长64字节, 仅限A-Z,a-z,0-9及"_",可为空
  322. */
  323. nonce: string;
  324. /**
  325. * 过期时间:从1970到过期时间的秒数
  326. */
  327. timestamp: number;
  328. /**
  329. * 角色,为admin时,表示该用户可以调用管控接口,可为空,如果要给当前用户admin权限,应该传admin
  330. */
  331. role?: string;
  332. /**
  333. * token
  334. */
  335. token: string;
  336. }
  337. interface ImCancelMuteAllReq {
  338. /**
  339. * @param groupId 群组id
  340. */
  341. groupId: string;
  342. }
  343. interface ImCancelMuteUserReq {
  344. /**
  345. * @param groupId 群组id
  346. */
  347. groupId: string;
  348. /**
  349. * @param userList 被取消禁言的用户列表
  350. */
  351. userList: string[];
  352. }
  353. interface ImCloseGroupReq {
  354. /**
  355. * @param groupId 群组id
  356. */
  357. groupId: string;
  358. }
  359. interface ImCreateGroupReq {
  360. /**
  361. * @param groupId 群组id,【可选】id为空的话,会由sdk内部生成
  362. */
  363. groupId?: string;
  364. /**
  365. * @param groupName 群组名称
  366. */
  367. groupName: string;
  368. /**
  369. * @param extension 业务扩展字段
  370. */
  371. groupMeta?: string;
  372. }
  373. interface ImCreateGroupRsp {
  374. /**
  375. * @param groupId 群组id
  376. */
  377. groupId: string;
  378. /**
  379. * @param alreadyExist 是否已经创建过
  380. */
  381. alreadyExist: boolean;
  382. }
  383. interface ImCreateStreamMessageReq {
  384. /**
  385. * 数据类型
  386. */
  387. dataType: ImStreamMessageDataType;
  388. /**
  389. * 数据接收类型
  390. */
  391. receiverType: ImStreamMessageReceiverType;
  392. /**
  393. * 数据接收者ID
  394. */
  395. receiverId: string;
  396. }
  397. interface ImDeleteMessageReq {
  398. /**
  399. * @param groupId 群组id
  400. */
  401. groupId: string;
  402. /**
  403. * @param messageId 消息id
  404. */
  405. messageId: string;
  406. }
  407. let ImEngine: typeof ImEngine_2;
  408. class ImEngine_2 extends EventEmitter<ImSdkListener> {
  409. private wasmIns;
  410. private wasmEngine;
  411. private wasmInterface;
  412. private transport?;
  413. private appEventManager?;
  414. private eventListener;
  415. private messageManager?;
  416. private groupManager?;
  417. private attachmentManager?;
  418. private pluginProvider?;
  419. private uploader;
  420. private supportsWebRtc;
  421. private supportWASM;
  422. private initFlag;
  423. constructor();
  424. static engine: ImEngine_2;
  425. /**
  426. * @brief 获取 SDK 引擎实例(单例)
  427. * @returns ImEngine
  428. */
  429. static createEngine(): ImEngine_2;
  430. /**
  431. * 当前 SDK 是否支持,支持 WASM 或者 ASM
  432. * @returns
  433. */
  434. static isSupport(): boolean;
  435. static getSdkVersion(): string;
  436. private initTransport;
  437. private initAppEvent;
  438. private loadWasm;
  439. private preloadUploader;
  440. private initNativePlugin;
  441. /**
  442. * @brief 初始化
  443. * @param config SDK配置信息
  444. */
  445. init(config: ImSdkConfig): Promise<0 | ImErrors.ERROR_CLIENT_REPEATED_INIT>;
  446. /**
  447. * 添加 Engine 事件监听
  448. */
  449. private addEventListener;
  450. private removeEventListener;
  451. private destroy;
  452. /**
  453. * @brief 销毁
  454. */
  455. unInit(): boolean;
  456. /**
  457. * @brief 登录
  458. * @param req 登录请求数据
  459. */
  460. login(loginReq: ImLoginReq): Promise<void>;
  461. /**
  462. * @brief 登出
  463. */
  464. logout(): Promise<void>;
  465. /**
  466. * 强制重连
  467. */
  468. reconnect(): void;
  469. /**
  470. * @brief 获取当前登录用户 ID
  471. */
  472. getCurrentUserId(): string;
  473. /**
  474. * @brief 是否登录
  475. */
  476. isLogin(): boolean;
  477. /**
  478. * @brief 是否已退出登录
  479. */
  480. isLogout(): boolean;
  481. /**
  482. * @brief 获取消息管理器 {AliVCIMMessageInterface}
  483. * @return 返回消息管理器实例
  484. */
  485. getMessageManager(): AliVCIMMessageManager | undefined;
  486. /**
  487. * @brief 获取群组管理器 {AliVCIMGroupInterface}
  488. * @return 返回群组管理器实例
  489. */
  490. getGroupManager(): AliVCIMGroupManager | undefined;
  491. /**
  492. * @brief 获取附件管理器 {AliVCIMAttachmentInterface}
  493. * @return 返回附件管理器实例
  494. */
  495. getAttachmentManager(): AliVCIMAttachmentManager | undefined;
  496. }
  497. enum ImErrors {
  498. /**
  499. * 已经登录
  500. */
  501. ERROR_HAS_LOGIN = 304,
  502. /**
  503. * 参数错误;参数无法解析
  504. */
  505. ERROR_INVALID_PARAM = 400,
  506. /**
  507. * 错误码(subcode) 说明
  508. * 403 操作无权限; 或登录时鉴权失败
  509. */
  510. ERROR_NO_PERMISSION = 403,
  511. /**
  512. * no session,可能因为客户网络变化等原因导致的连接变化,服务器在新连接上收到消息无法正常处理,需要reconnect 信令。
  513. */
  514. ERROR_NO_SESSION = 404,
  515. /**
  516. * 审核不通过
  517. */
  518. ERROR_AUDIT_FAIL = 406,
  519. /**
  520. * 繁忙,发送太快,稍候重试
  521. * 服务端同学确认不需要区分这两个错误
  522. */
  523. ERROR_INTERNAL_BUSY = 412,
  524. ERROR_INTERNAL_BUSY2 = 413,
  525. /**
  526. * 发送 c2c 消息对方用户不在线
  527. */
  528. ERROR_USER_OFFLINE = 424,
  529. /**
  530. * 未加入群组
  531. */
  532. ERROR_GROUP_NOT_JOINED = 425,
  533. /**
  534. * 操作过快,短时间内,发起过多请求。如同一个用户,1秒内发起2次登录。
  535. */
  536. ERROR_INTERNAL_BUSY3 = 429,
  537. /**
  538. * 群组不存在
  539. */
  540. ERROR_GROUP_NOT_EXIST = 440,
  541. /**
  542. * 群组已删除
  543. */
  544. ERROR_GROUP_DELETED = 441,
  545. /**
  546. * 无法在该群组中发送消息,被禁言
  547. */
  548. ERROR_SEND_GROUP_MSG_FAIL = 442,
  549. /**
  550. * 进了太多的群组, 列表人数超大等
  551. */
  552. ERROR_REACH_MAX = 443,
  553. /**
  554. * 无法加入该群,被禁止加入(暂无需求未实现)预留
  555. */
  556. ERROR_JOIN_GROUP_FAIL = 450,
  557. /**
  558. * ots 查询错误
  559. */
  560. ERROR_OTS_FAIL = 480,
  561. /**
  562. * 系统临时错误,稍候重试
  563. */
  564. ERROR_INTERNALE_RROR = 500,
  565. /**
  566. * 底层重复初始化
  567. */
  568. ERROR_CLIENT_REPEATED_INIT = -1,
  569. /**
  570. * 初始化配置信息有误
  571. */
  572. ERROR_CLIENT_INIT_INVALID_PARAM = -2,
  573. /**
  574. * 未初始化
  575. */
  576. ERROR_CLIENT_NOT_INIT = 1,
  577. /**
  578. * 参数异常
  579. */
  580. ERROR_CLIENT_INVALID_PARAM = 2,
  581. /**
  582. * 状态有误
  583. */
  584. ERROR_CLIENT_INVALID_STATE = 3,
  585. /**
  586. * 建连失败
  587. */
  588. ERROR_CLIENT_CONNECT_ERROR = 4,
  589. /**
  590. * 建连超时
  591. */
  592. ERROR_CLIENT_CONNECT_TIMEOUT = 5,
  593. /**
  594. * 发送失败
  595. */
  596. ERROR_CLIENT_SEND_FAILED = 6,
  597. /**
  598. * 发送取消
  599. */
  600. ERROR_CLIENT_SEND_CANCEL = 7,
  601. /**
  602. * 发送超时
  603. */
  604. ERROR_CLIENT_SEND_TIMEOUT = 8,
  605. /**
  606. * 订阅失败
  607. */
  608. ERROR_CLIENT_SUB_ERROR = 9,
  609. /**
  610. * 订阅通道断连
  611. */
  612. ERROR_CLIENT_SUB_DISCONNECT = 10,
  613. /**
  614. * 订阅超时
  615. */
  616. ERROR_CLIENT_SUB_TIMEOUT = 11,
  617. /**
  618. * 压缩失败
  619. */
  620. ERROR_CLIENT_COMPRESS_ERROR = 12,
  621. /**
  622. * 解压失败
  623. */
  624. ERROR_CLIENT_DECOMPRESS_ERROR = 13,
  625. /**
  626. * 加密失败
  627. */
  628. ERROR_CLIENT_ENCRYPT_ERROR = 14,
  629. /**
  630. * 解密失败
  631. */
  632. ERROR_CLIENT_DECRYPT_ERROR = 15,
  633. /**
  634. * 消息体封装失败
  635. */
  636. ERROR_CLIENT_CONVERTER_ERROR = 16,
  637. /**
  638. * 消息体解析失败
  639. */
  640. ERROR_CLIENT_PARSE_ERROR = 17,
  641. /**
  642. * 数据为空
  643. */
  644. ERROR_CLIENT_DATA_EMPTY = 18,
  645. /**
  646. * 数据错误
  647. */
  648. ERROR_CLIENT_DATA_ERROR = 19,
  649. /**
  650. * 地址出错(可能是AppSign有误,如头部带了空格、内容被截断等)
  651. */
  652. ERROR_CLIENT_URL_ERROR = 20,
  653. /**
  654. * 建连取消
  655. */
  656. CONNECT_CANCEL = 21,
  657. /**
  658. * 重试超过次数限制
  659. */
  660. RETRY_OVER_TIME = 22,
  661. /**
  662. * 状态错误
  663. */
  664. ERROR_INVALID_STATE = 601,
  665. /**
  666. * 未登录
  667. */
  668. ERROR_NOT_LOGIN = 602,
  669. /**
  670. * 收到上次session的消息
  671. */
  672. ERROR_RECEIVE_LAST_SESSION = 603,
  673. /**
  674. * Parse Data Error
  675. */
  676. ERROR_PARSE_DATA_ERROR = 604
  677. }
  678. interface ImForwardCustomMessageReq {
  679. /**
  680. * 数据接收者ID
  681. */
  682. receiverId: string;
  683. /**
  684. * 数据,若需要传对象,需要序列化
  685. */
  686. data: string;
  687. }
  688. interface ImForwardCustomMessageRsp {
  689. /**
  690. * 流式消息ID
  691. */
  692. messageId: string;
  693. /**
  694. * 数据,若返回的是对象,需要反序列化
  695. */
  696. data: string;
  697. }
  698. interface ImGroupInfo {
  699. /**
  700. * @param groupId 群组id
  701. */
  702. groupId: string;
  703. /**
  704. * @param groupName 群组名称
  705. */
  706. groupName: string;
  707. /**
  708. * @param groupMeta 群组透传信息
  709. */
  710. groupMeta: string;
  711. /**
  712. * @param createTime 创建时间
  713. */
  714. createTime: number;
  715. /**
  716. * @param creator 创建者id
  717. */
  718. creator: string;
  719. /**
  720. * @param admins 管理员列表
  721. */
  722. admins: string[];
  723. /**
  724. * @param statistics 群组统计
  725. */
  726. statistics: ImGroupStatistics;
  727. /**
  728. * @param muteStatus 群禁言信息
  729. */
  730. muteStatus: ImGroupMuteStatus;
  731. }
  732. interface ImGroupInfoStatus {
  733. /**
  734. * @param groupId 群组id
  735. */
  736. groupId: string;
  737. /**
  738. * @param groupMeta 群组扩展信息
  739. */
  740. groupMeta: string;
  741. /**
  742. * @param adminList 管理员列表
  743. */
  744. adminList: string[];
  745. }
  746. interface ImGroupListener {
  747. /**
  748. * @deprecated 1.4.1 后请使用 memberdatachange 事件
  749. *
  750. * 群组成员变化
  751. * @param groupId 群组ID
  752. * @param memberCount 当前群组人数
  753. * @param joinUsers 加入的用户
  754. * @param leaveUsers 离开的用户
  755. */
  756. memberchange: (groupId: string, memberCount: number, joinUsers: ImUser[], leaveUsers: ImUser[]) => void;
  757. /**
  758. * 1.4.1 版本新增新的群组成员变化,返回的是一个对象
  759. * @param data 群组成员变化数据对象
  760. * @param data.groupId 群组ID
  761. * @param data.onlineCount 当前群组在线人数
  762. * @param data.pv 加入群组累积pv数
  763. * @param data.isBigGroup 是否是大群组
  764. * @param data.joinUsers 加入的用户
  765. * @param data.leaveUsers 离开的用户
  766. */
  767. memberdatachange: (data: ImMemberChangeData) => void;
  768. /**
  769. * 退出群组
  770. * @param groupId 群组ID
  771. * @param reason 退出原因 1: 群被解散, 2:被踢出来了
  772. */
  773. exit: (groupId: string, reason: number) => void;
  774. /**
  775. * 群组静音状态变化
  776. * @param groupId 群组ID
  777. * @param status 静音状态
  778. */
  779. mutechange: (groupId: string, status: ImGroupMuteStatus) => void;
  780. /**
  781. * 群组信息变化
  782. * @param groupId 群组ID
  783. * @param info 群组信息
  784. */
  785. infochange: (groupId: string, info: ImGroupInfoStatus) => void;
  786. }
  787. interface ImGroupMuteStatus {
  788. /**
  789. * @param groupId 群组id
  790. */
  791. groupId: string;
  792. /**
  793. * @param muteAll 是否全员禁言
  794. */
  795. muteAll: boolean;
  796. /**
  797. * @param muteUserList 禁言用户ID列表
  798. */
  799. muteUserList: string[];
  800. /**
  801. * @param whiteUserList 白名单用户ID列表
  802. */
  803. whiteUserList: string[];
  804. }
  805. interface ImGroupStatistics {
  806. /**
  807. * @param pv PV
  808. */
  809. pv: number;
  810. /**
  811. * @param onlineCount 在线人数
  812. */
  813. onlineCount: number;
  814. /**
  815. * @param msgAmount 消息数量
  816. */
  817. msgAmount: {
  818. [key: string]: number;
  819. };
  820. }
  821. interface ImJoinGroupReq {
  822. /**
  823. * @param groupId 群组id
  824. */
  825. groupId: string;
  826. }
  827. interface ImLeaveGroupReq {
  828. /**
  829. * @param groupId 群组id
  830. */
  831. groupId: string;
  832. }
  833. interface ImListGroupUserReq {
  834. /**
  835. * @param groupId 群组id
  836. */
  837. groupId: string;
  838. /**
  839. * @param sortType 排序方式,ASC-先加入优先,DESC-后加入优先
  840. */
  841. sortType?: ImSortType;
  842. /**
  843. * @param nextPageToken 默认表示第一页,遍历时服务端会返回,客户端获取下一页时,应带上
  844. */
  845. nextPageToken?: number;
  846. /**
  847. * @deprecated 请使用 nextPageToken
  848. */
  849. nextpagetoken?: number;
  850. /**
  851. * @param pageSize 最大不超过50
  852. */
  853. pageSize?: number;
  854. }
  855. interface ImListGroupUserRsp {
  856. /**
  857. * @param groupId 群组id
  858. */
  859. groupId: string;
  860. /**
  861. * @param nextPageToken 下一页的token
  862. */
  863. nextPageToken: number;
  864. /**
  865. * @deprecated 请使用 nextPageToken
  866. */
  867. nextpagetoken?: number;
  868. /**
  869. * @param hasMore 是否还有下一页
  870. */
  871. hasMore: boolean;
  872. /**
  873. * @param userList 返回的群组的在线成员列表
  874. */
  875. userList: ImUser[];
  876. }
  877. interface ImListHistoryMessageReq {
  878. /**
  879. * @param groupId 群组id
  880. */
  881. groupId: string;
  882. /**
  883. * @param type 消息类型
  884. */
  885. type: number;
  886. /**
  887. * @param nextPageToken 不传时表示第一页,遍历时服务端会返回,客户端获取下一页时,应带上
  888. */
  889. nextPageToken?: number;
  890. /**
  891. * @param sortType 排序类型,默认为时间递增
  892. */
  893. sortType?: ImSortType;
  894. /**
  895. * @param pageSize 取值范围 10~30
  896. */
  897. pageSize?: number;
  898. /**
  899. * @param begintime 按时间范围遍历,开始时间,不传时表示最早时间,单位:秒
  900. */
  901. beginTime?: number;
  902. /**
  903. * @param endtime 按时间范围遍历,结束时间,不传时表示最晚时间,单位:秒
  904. */
  905. endTime?: number;
  906. }
  907. interface ImListHistoryMessageRsp {
  908. /**
  909. * @param groupId 群组id
  910. */
  911. groupId: string;
  912. /**
  913. * @param nextPageToken 不传时表示第一页,遍历时服务端会返回,客户端获取下一页时,应带上
  914. */
  915. nextPageToken?: number;
  916. /**
  917. *@param hasMore 是否有更多数据
  918. */
  919. hasMore: boolean;
  920. /**
  921. *@param messageList 返回消息列表
  922. **/
  923. messageList: ImMessage[];
  924. }
  925. interface ImListMessageReq {
  926. /**
  927. * @param groupId 话题id,聊天插件实例id
  928. */
  929. groupId: string;
  930. /**
  931. * @param type 消息类型
  932. */
  933. type: number;
  934. /**
  935. * @param nextPageToken 不传时表示第一页,遍历时服务端会返回,客户端获取下一页时应带上
  936. */
  937. nextPageToken?: number;
  938. /**
  939. * @deprecated 请使用nextPageToken
  940. */
  941. nextpagetoken?: number;
  942. /**
  943. * @param sortType 排序类型,默认为时间递增
  944. */
  945. sortType?: ImSortType;
  946. /**
  947. * @param pageSize 分页拉取的大小,默认10条,最大30条
  948. */
  949. pageSize?: number;
  950. /**
  951. * @param begintime 按时间范围遍历,开始时间,不传时表示最早时间,单位:秒
  952. */
  953. beginTime?: number;
  954. /**
  955. * @param endtime 按时间范围遍历,结束时间,不传时表示最晚时间,单位:秒
  956. */
  957. endTime?: number;
  958. }
  959. interface ImListMessageRsp {
  960. /**
  961. ** @param groupId 群组id
  962. */
  963. groupId: string;
  964. /**
  965. *@param nextpagetoken 客户端获取下一页时,应带上
  966. */
  967. nextPageToken: number;
  968. /**
  969. * @deprecated 请使用 nextPageToken
  970. */
  971. nextpagetoken?: number;
  972. /**
  973. *@param hasmore 是否有更多数据
  974. */
  975. hasMore: boolean;
  976. /**
  977. *@param messageList 返回消息列表
  978. **/
  979. messageList: ImMessage[];
  980. }
  981. interface ImListMuteUsersReq {
  982. /**
  983. * @param groupId 群组id
  984. */
  985. groupId: string;
  986. }
  987. interface ImListMuteUsersRsp {
  988. /**
  989. * @param groupId 群组id
  990. */
  991. groupId: string;
  992. /**
  993. * @param muteAll 是否全员禁言
  994. */
  995. muteAll: boolean;
  996. /**
  997. * @param muteUserList 禁言用户ID列表
  998. */
  999. muteUserList: string[];
  1000. /**
  1001. * @param whiteUserList 白名单用户ID列表
  1002. */
  1003. whiteUserList: string[];
  1004. }
  1005. interface ImListRecentGroupUserReq {
  1006. /**
  1007. * @param groupId 群组id
  1008. */
  1009. groupId: string;
  1010. }
  1011. interface ImListRecentGroupUserRsp {
  1012. /**
  1013. * @param groupId 群组id
  1014. */
  1015. groupId: string;
  1016. /**
  1017. * @param total 群组成员总数
  1018. */
  1019. total: number;
  1020. /**
  1021. * @param userList 返回的群组的在线成员列表
  1022. */
  1023. userList: ImUser[];
  1024. }
  1025. interface ImListRecentMessageReq {
  1026. /**
  1027. * @param groupId 群组id
  1028. */
  1029. groupId: string;
  1030. /**
  1031. * @param seqnum 消息序列号
  1032. */
  1033. seqnum?: number;
  1034. /**
  1035. * @param pageSize 分页拉取的大小,默认50条
  1036. */
  1037. pageSize?: number;
  1038. }
  1039. interface ImListRecentMessageRsp {
  1040. /**
  1041. * @param groupId 群组id
  1042. */
  1043. groupId: string;
  1044. /**
  1045. * @param messageList 返回消息列表
  1046. */
  1047. messageList: ImMessage[];
  1048. }
  1049. interface ImLoginReq {
  1050. user: ImUser;
  1051. /**
  1052. * 用户鉴权信息
  1053. */
  1054. userAuth: ImAuth;
  1055. }
  1056. enum ImLogLevel {
  1057. NONE = 0,
  1058. DBUG = 1,
  1059. INFO = 2,
  1060. WARN = 3,
  1061. ERROR = 4
  1062. }
  1063. interface ImMemberChangeData {
  1064. groupId: string;
  1065. onlineCount: number;
  1066. pv: number;
  1067. isBigGroup: boolean;
  1068. joinUsers: ImUser[];
  1069. leaveUsers: ImUser[];
  1070. }
  1071. interface ImMessage {
  1072. /**
  1073. * @param groupId 话题id,聊天插件实例id
  1074. */
  1075. groupId?: string;
  1076. /**
  1077. * @param messageId 消息id
  1078. */
  1079. messageId: string;
  1080. /**
  1081. *@param type 消息类型。系统消息小于10000
  1082. */
  1083. type: number;
  1084. /**
  1085. *@param sender 发送者
  1086. */
  1087. sender?: ImUser;
  1088. /**
  1089. **@param data 消息内容
  1090. */
  1091. data: string;
  1092. /**
  1093. *@param seqnum 消息顺序号
  1094. */
  1095. seqnum: number;
  1096. /**
  1097. *@param timestamp 消息发送时间
  1098. */
  1099. timestamp: number;
  1100. /**
  1101. *@param level 消息分级
  1102. **/
  1103. level: ImMessageLevel;
  1104. /**
  1105. * @param repeatCount 消息统计数量增长值,默认1,主要用于聚合同类型消息。
  1106. */
  1107. repeatCount: number;
  1108. /**
  1109. * @param totalMsgs 同类型的消息数量
  1110. */
  1111. totalMsgs: number;
  1112. }
  1113. enum ImMessageLevel {
  1114. NORMAL = 0,
  1115. HIGH = 1
  1116. }
  1117. interface ImMessageListener {
  1118. /**
  1119. * 接收到c2c消息
  1120. * @param msg 消息
  1121. */
  1122. recvc2cmessage: (msg: ImMessage) => void;
  1123. /**
  1124. * 接收到群消息
  1125. * @param msg 消息
  1126. * @param groupId 群id
  1127. */
  1128. recvgroupmessage: (msg: ImMessage, groupId: string) => void;
  1129. /**
  1130. * 删除群消息
  1131. * @param msgId 消息id
  1132. * @param groupId 群id
  1133. */
  1134. deletegroupmessage: (msgId: string, groupId: string) => void;
  1135. /**
  1136. * 流消息结束通知
  1137. * @param {string} messageId 消息ID
  1138. * @param {number} endCode 结束原因:0正常处理结束,1主动取消,2与智能体服务连接异常断开,3连接超时断开,4收到新的开始切片,5包请求异常
  1139. * @param {number} [subCode] 详情码
  1140. * @param {string} [subMsg] 详情信息
  1141. */
  1142. streammessageend: (messageId: string, endCode: number, subCode?: number, subMsg?: string) => void;
  1143. /**
  1144. * 接收到流消息
  1145. * @param message 流消息
  1146. */
  1147. recvstreammessage: (message: ImStreamMessage) => void;
  1148. }
  1149. interface ImModifyGroupReq {
  1150. /**
  1151. * @param groupId 群组id
  1152. */
  1153. groupId: string;
  1154. /**
  1155. * @param forceUpdateGroupMeta 为true表示强制刷新groupMeta信息,若groupMeta为空则表示清空;
  1156. * 为false,则只有groupMeta不空才更新groupMeta信息
  1157. */
  1158. forceUpdateGroupMeta?: boolean;
  1159. /**
  1160. * @param groupMeta 群信息扩展字段
  1161. */
  1162. groupMeta?: string;
  1163. /**
  1164. * @param forceUpdateAdmins 为true表示强制刷新admins信息,若admins为空则表示清空;
  1165. * 为false,则只有admins不空才更新admins信息
  1166. */
  1167. forceUpdateAdmins?: boolean;
  1168. /**
  1169. * @param admins 群管理员ID列表,最多设置3个管理员
  1170. */
  1171. admins?: string[];
  1172. }
  1173. interface ImMuteAllReq {
  1174. /**
  1175. * @param groupId 群组id
  1176. */
  1177. groupId: string;
  1178. }
  1179. interface ImMuteUserReq {
  1180. /**
  1181. * @param groupId 群组id
  1182. */
  1183. groupId: string;
  1184. /**
  1185. * @param userList 需要禁言的用户列表
  1186. */
  1187. userList: string[];
  1188. }
  1189. interface ImQueryGroupReq {
  1190. /**
  1191. * @param groupId 群组id
  1192. */
  1193. groupId: string;
  1194. }
  1195. interface ImRejectStreamMessageReq {
  1196. /**
  1197. * 流式消息ID
  1198. */
  1199. messageId: string;
  1200. /**
  1201. * 数据接收类型
  1202. */
  1203. receiverType: ImStreamMessageReceiverType;
  1204. /**
  1205. * 错误码
  1206. */
  1207. code: number;
  1208. /**
  1209. * 错误信息
  1210. */
  1211. msg: string;
  1212. }
  1213. interface ImSdkConfig {
  1214. /**
  1215. * 设备唯一标识
  1216. */
  1217. deviceId?: string;
  1218. /**
  1219. * 应用ID
  1220. */
  1221. appId: string;
  1222. /**
  1223. * 应用签名
  1224. */
  1225. appSign: string;
  1226. /**
  1227. * 日志级别
  1228. */
  1229. logLevel?: ImLogLevel;
  1230. /**
  1231. * 来源
  1232. */
  1233. source?: string;
  1234. /**
  1235. * 心跳超时时间,单位是秒,默认 99s,允许 [15-120]s
  1236. */
  1237. heartbeatTimeout?: number;
  1238. /**
  1239. * @param extra 用户自定义参数
  1240. */
  1241. extra?: {
  1242. [key: string]: string;
  1243. };
  1244. /**
  1245. * @param uploader 附件上传器参数
  1246. */
  1247. uploader?: {
  1248. /**
  1249. * 是否提前加载,默认 false
  1250. */
  1251. preload?: boolean;
  1252. /**
  1253. * 指定sdk文件地址
  1254. */
  1255. sdkUrl?: string;
  1256. };
  1257. }
  1258. interface ImSdkListener {
  1259. /**
  1260. * 连接中
  1261. */
  1262. connecting: () => void;
  1263. /**
  1264. * 连接成功
  1265. */
  1266. connectsuccess: () => void;
  1267. /**
  1268. * 连接失败
  1269. */
  1270. connectfailed: (error: Error) => void;
  1271. /**
  1272. * 连接断开
  1273. * @param code 断开原因 1:主动退出, 2:被踢出 3:超时等其他原因 4:在其他端上登录
  1274. */
  1275. disconnect: (code: number) => void;
  1276. /**
  1277. * 连接状态变化
  1278. * state 状态 0:未连接 1:连接中 2:已连接 3:已断联
  1279. */
  1280. linkstate: (data: {
  1281. previousState: number;
  1282. currentState: number;
  1283. }) => void;
  1284. /**
  1285. * token过期
  1286. * @param callback 更新 Token 的回调
  1287. */
  1288. tokenexpired: (callback: TokenCallback) => void;
  1289. /**
  1290. * 重连成功
  1291. */
  1292. reconnectsuccess: (groupInfos: ImGroupInfo[]) => void;
  1293. }
  1294. interface ImSendMessageToGroupReq {
  1295. /**
  1296. * @param groupId 话题id,聊天插件实例id
  1297. */
  1298. groupId: string;
  1299. /**
  1300. * @param type 消息类型,小于等于10000位系统消息,大于10000位自定义消息
  1301. */
  1302. type: number;
  1303. /**
  1304. * @param data 消息体
  1305. */
  1306. data: string;
  1307. /**
  1308. * @param skipMuteCheck 跳过禁言检测,true:忽略被禁言用户,还可发消息;false:当被禁言时,消息无法发送,默认为false,即为不跳过禁言检测。
  1309. */
  1310. skipMuteCheck?: boolean;
  1311. /**
  1312. * @param skipAudit 跳过安全审核,true:发送的消息不经过阿里云安全审核服务审核;false:发送的消息经过阿里云安全审核服务审核,审核失败则不发送;
  1313. */
  1314. skipAudit?: boolean;
  1315. /**
  1316. * @param level 消息分级
  1317. */
  1318. level?: ImMessageLevel;
  1319. /**
  1320. * @param noStorage 为true时,表示该消息不需要存储,也无法拉取查询
  1321. */
  1322. noStorage?: boolean;
  1323. /**
  1324. * @param repeatCount 消息统计数量增长值,默认1,主要用于聚合同类型消息,只发送一次请求,例如点赞场景
  1325. */
  1326. repeatCount?: number;
  1327. }
  1328. interface ImSendMessageToUserReq {
  1329. /**
  1330. * 消息类型。系统消息小于10000
  1331. */
  1332. type: number;
  1333. /**
  1334. * 消息体
  1335. */
  1336. data: string;
  1337. /**
  1338. * 接收者用户
  1339. */
  1340. receiverId: string;
  1341. /**
  1342. * 跳过安全审核,true:发送的消息不经过阿里云安全审核服务审核;false:发送的消息经过阿里云安全审核服务审核,审核失败则不发送;
  1343. */
  1344. skipAudit?: boolean;
  1345. /**
  1346. * 消息分级
  1347. */
  1348. level?: ImMessageLevel;
  1349. }
  1350. enum ImSortType {
  1351. ASC = 0,
  1352. DESC = 1
  1353. }
  1354. interface ImStreamData {
  1355. seqNum: number;
  1356. byteData: ArrayBuffer;
  1357. }
  1358. interface ImStreamMessage {
  1359. /**
  1360. * 流式消息ID
  1361. */
  1362. messageId: string;
  1363. /**
  1364. * 发送用户
  1365. */
  1366. sender: ImUser;
  1367. /**
  1368. * 流式消息帧数据
  1369. */
  1370. data: ImStreamData;
  1371. }
  1372. enum ImStreamMessageDataType {
  1373. TEXT = 1,// 文本
  1374. BINARY_FILE = 2
  1375. }
  1376. enum ImStreamMessageReceiverType {
  1377. SERVER = 0
  1378. }
  1379. class ImStreamMessageSender extends EventEmitter<ImStreamMessageSenderListener> {
  1380. private wasmIns;
  1381. private sender;
  1382. constructor(wasmIns: any);
  1383. setSender(sender: any): void;
  1384. getMessageId(): string;
  1385. /**
  1386. * 发送字节数据
  1387. * @param {Uint8Array} byteData 字节数据
  1388. * @param {boolean} isLast 是否结束流
  1389. * @param {ImAttachmentRes[]} [attachments] 附件列表
  1390. */
  1391. sendByteData(byteData: Uint8Array, isLast: boolean, attachments?: ImAttachmentRes[]): void;
  1392. /**
  1393. * 取消发送
  1394. * @param {number} [code] 取消码
  1395. * @param {string} [msg] 取消原因
  1396. */
  1397. cancel(code?: number, msg?: string): void;
  1398. destroy(): void;
  1399. }
  1400. interface ImStreamMessageSenderListener {
  1401. /**
  1402. * 流消息结束通知
  1403. * @param {string} messageId 消息ID
  1404. * @param {number} endCode 结束原因:0正常处理结束,1主动取消,2与智能体服务连接异常断开,3连接超时断开,4收到新的开始切片,5包请求异常
  1405. * @param {number} [subCode] 详情码
  1406. * @param {string} [subMsg] 详情信息
  1407. */
  1408. streammessageend: (messageId: string, endCode: number, subCode?: number, subMsg?: string) => void;
  1409. }
  1410. enum ImStreamMessageStatus {
  1411. CONTINUE = 0,// 中间帧
  1412. START = 1,// 开始帧
  1413. END = 2,// 结束帧
  1414. ALL = 3,// 一次性传输
  1415. CANCEL = 4
  1416. }
  1417. enum ImStreamMessageType {
  1418. NORMAL = 0
  1419. }
  1420. interface ImUser {
  1421. /**
  1422. * @param user_id 用户id
  1423. */
  1424. userId: string;
  1425. /**
  1426. * @param user_extension 用户扩展信息
  1427. */
  1428. userExtension?: string;
  1429. }
  1430. type TokenCallback = (error: {
  1431. code?: number;
  1432. msg: string;
  1433. } | null, auth?: ImAuth) => void;
  1434. }