easemob-websdk 4.13.0 → 4.14.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,327 @@
1
+ # Changes to easemob chat
2
+
3
+ ## 4.14.0 (Apr 18, 2025)
4
+
5
+ ### 新增特性
6
+
7
+ - 支持 [GIF 图片消息]。
8
+ - 支持 [群组头像功能]。
9
+ - 支持 [附件鉴权功能]。该功能需要联系商务开通,开通后必须调用 SDK 的 API 才能下载消息附件。
10
+ - 支持 [支持自定义设备平台]。
11
+ - unipush 推送安卓平台支持 Google FCM
12
+
13
+ ## 4.13.0 (Mar 12, 2025)
14
+
15
+ ### 新增特性
16
+
17
+ 1. `modifyMessage` 发送后修改消息接口新增可修改的消息类型:
18
+ 支持修改的消息类型如下:
19
+ - 文本消息:支持修改 `msg` 和 `ext` 字段。
20
+ - 自定义消息:支持修改 `customEvent` 、 `customExts` 和 `ext` 字段。
21
+ - 图片/语音/视频/文件/位置/合并消息:仅支持修改 `ext` 字段。
22
+ - 命令消息:不支持修改。
23
+ 2. 小程序 SDK 支持运行到微信小游戏平台
24
+
25
+ ### 优化
26
+
27
+ 1. SDK 内部捕获重试 DNS 失败的错误
28
+
29
+ ## 4.12.0 (Jan 9, 2025)
30
+
31
+ ### 新增特性
32
+
33
+ 1. `onModifiedMessage` 事件回调中增加 ext 字段。
34
+ 2. 加入聊天室 `joinChatRoom` 成功回调新增当前聊天室信息。
35
+
36
+ ### 修复
37
+
38
+ 1. 格式化小程序 SDK API 请求失败错误码, 和 Web 端统一。
39
+ 2. 修复 uniapp sdk 在 4.36 版本运行到鸿蒙平台,无限重连的问题。
40
+ 3. 修复偶现无法拉取消息的问题。
41
+
42
+ ### 优化
43
+
44
+ 1. 优化重连时间间隔
45
+ 2. 小程序 SDK 支持 httpDNS, 默认开启
46
+
47
+ ## 4.11.0 (Nov 29, 2024)
48
+
49
+ ### 新增特性
50
+
51
+ 1. 获取历史消息时,消息体内增加 isRead, isDelivery 字段,只支持单聊。
52
+ 2. 禁言回调中携带禁言到期的时间戳。
53
+ 3. 去掉 sockjs
54
+ 4. 群组/聊天室禁言事件增加 userId 字段,表示被禁言的人
55
+ 5. uniapp sdk 支持鸿蒙系统
56
+
57
+ ### 修复
58
+
59
+ 1. 修复 pin 消息事件 conversationId 不对
60
+
61
+ ## 4.10.0 (Oct 10, 2024)
62
+
63
+ ### 新增特性
64
+
65
+ 1. 聊天室修改公告时回调中增加公告内容, updateAnnouncement 事件中增加 announcement 字段,表示更新的公告
66
+ 2. 增加错误码 :
67
+ WEBIM_USER_ALREADY_LOGIN 208 用户已登录
68
+ MESSAGE_SEND_TIMEOUT 512 发送消息超时
69
+ 3. 增加 onShow 方法, 小程序或 uniapp 在 onShow 生命周期里执行这个方法, 可以优化重连速度
70
+
71
+ ### 优化
72
+
73
+ 登录方法优化, 调整 open 方法执行 open().then 时机, 调整为在连接鉴权成功之后触发, 在 open().then 中就可以发送消息, 不用再等 onConnected 事件, 同时鉴权失败等登录的错误会在 open.catch 中抛出
74
+
75
+ # 4.9.2 (Sep 19, 2024)
76
+
77
+ - feat: `removeHistoryMessages` support chatRoom.
78
+
79
+ # 4.9.1 (Sep 5, 2024)
80
+
81
+ - feat: support uni-push plugin.
82
+ - chore: fix type errors and debug logs.
83
+
84
+ # 4.9.0 (August 29, 2024)
85
+
86
+ - Add `onOfflineMessageSyncStart` and `onOfflineMessageSyncFinish` event.
87
+ - Add multi device events `setSilentModeForConversation` and `removeSilentModeForConversation`.
88
+ - Fix `ChatroomEvent` and `GroupEvent` missed `reason` field.
89
+ - PIN message support single chat.
90
+ - Add callback error when get DNS failed
91
+ - Remove redundant judgment at reconnecting.
92
+ - chore: fix type errors and debug logs
93
+
94
+ # 4.8.1 (Jul 15, 2024)
95
+
96
+ - Fix uploading logs takes too much time
97
+
98
+ # 4.8.1-beta (Jul 2, 2024)
99
+
100
+ - Fix the mini program is not able to report logs
101
+ - Fix not export types issue
102
+
103
+ # 4.8.0 (June 28, 2024)
104
+
105
+ - `onDisconnected` event add callback params to give the disconnected reason.
106
+ - Adds allow extension field to be carried when the device logs in and passes them to the kicked device.
107
+ - `setLoginInfoCustomExt` Set the device's login extension field.
108
+ - `onDisconnected` In a multi-device login scenario, if the current device is kicked offline by the newly logged-in device, the event received by the kicked device will carry the extended information of the new device.
109
+ - Adds `Connection Parameters#isFixedDeviceId` initialization params, default is `true`, use fixed deviceId, precede version SDK is used random deviceId.
110
+ - `destroyChatRoom` supports the chatroom owner to destroy a chatroom.
111
+ - `joinChatRoom` supports passing in extension field and whether to exit other joined chatrooms when joining a chatroom.
112
+ - Adds report SDK log feature.
113
+ - Increase the timeout period for SDK to connect to the server.
114
+ - Fix on uniapp vue3 platform SDK reconnect failed.
115
+
116
+ # 4.7.0 (April 26, 2024)
117
+
118
+ - `recallMessage` methods add custom field `ext` params.
119
+ - Adds `getJoinedChatRooms` method to get the current user has joined chat room list.
120
+ - Adds `logger.setConsoleLogVisibility` method to sets whether to output logs to the console.
121
+ - Fix `allowGroupAck` status error
122
+
123
+ # 4.6.0 (April 2, 2024)
124
+
125
+ - Adds pin message feature.
126
+ - pinMessage
127
+ - unpinMessage
128
+ - getServerPinnedMessages
129
+ - Adds `onMessagePinEvent` callback to handle the message pin event.
130
+ - `onModifiedMessage` support custom message.
131
+ - `getHistoryMessages` support get chat room history message.
132
+ - Support custom chat room ID.
133
+ - Optimize token login failed error code for make the reason more clearly.
134
+ - Fix the message field `onlineState` status error.
135
+
136
+ # 4.5.1 (Feb 21, 2024)
137
+
138
+ - Format the attachment file url.
139
+ - Fixed bug when UniApp run ios platform send receiverList msg
140
+
141
+ # 4.5.0 (Jan 30, 2024)
142
+
143
+ - The member absence and presence events of chat rooms and groups have added a `memberCount` field
144
+ - Adds the `deleteAllMessagesAndConversations` methods, which can clear the chat history of the current user, including messages and conversations
145
+ - Adds the getSelfIdsOnOtherPlatform method, which can get a list of login IDs of the current user on other login devices, and realize sending messages to specified devices
146
+ - Removed unnecessary unique fields from the Web local database
147
+ - Format the customExts field of the most recent custom message in the conversation list
148
+ - Fix the issue of pulling messages repeatedly
149
+ - Fix the issue of abnormal message order in the `onMessage` callback
150
+ - Fix the error of introducing the MiniCore plugin in vite electron
151
+ - Fix the issue of abnormal API request parameters for `updateOwnUserInfo` after introducing the WeChat SDK in H5
152
+
153
+ # 4.4.0 (Dec 22, 2023)
154
+
155
+ - Adds conversation Conversation Mark
156
+ - addConversationMark
157
+ - removeConversationMark
158
+ - getServerConversationsByFilter
159
+ - Adds Attach Slice Upload
160
+ - Adds `onMessage` Event
161
+ - Adds thumbnail to video message
162
+
163
+ # 4.3.1 (Dec 13, 2023)
164
+
165
+ - Adds use replaced message contents
166
+ - Adds MiniCore SDK logger
167
+ - Verify that the `open` parameter user is not defined
168
+ - Types `SendMsgResult` add a message field
169
+ - Fixed the socket not closing when the network is offline on some device
170
+
171
+ # 4.3.0 (Nov 13, 2023)
172
+
173
+ - Adds contact API
174
+ - setContactRemark
175
+ - getAllContacts
176
+ - getContactsWithCursor
177
+ - Adds chatRoom broadcast
178
+ - Adds token expiration callback
179
+
180
+ # 4.2.1 (SEP 26, 2023)
181
+
182
+ - Adds LocalCache API
183
+ - getLocalConversations
184
+ - setLocalConversationCustomField
185
+ - getLocalConversation
186
+ - removeLocalConversation
187
+ - clearConversationUnreadCount
188
+ - onGroupEvent `joinPublicGroupDeclined` callback add the applicant userID
189
+
190
+ # 4.2.0 (Jul 27, 2023)
191
+
192
+ - Adds editing message after sent function
193
+ - Adds message merging and forwarding function
194
+ - Fix sending unnecessary delivery messages
195
+
196
+ # 4.1.7 (Jun 8, 2023)
197
+
198
+ - Adds the `pinConversation` method to pin or unpin a conversation.
199
+ - Adds the `getServerPinnedConversations` method to gets the list of pinned conversations from the server with pagination.
200
+ - Adds the `getServerConversations` method to get the sorted list of conversations from the server with pagination.
201
+ - Adds the feature of sending targeted messages in a group or chat room conversation by adding the `receiverList` parameter to the `create` method.
202
+ - Adds the `isLast` parameter to the `getHistoryMessages` method to indicate whether the returned data is that of the last page.
203
+ - Adds the `thumbnailWidth` and `thumbnailHeight` parameters to the `create` method to allow you to set the width and height of the thumbnail when sending an image.
204
+ - Adds the following errors to error codes 2 (WEBIM_CONNCTION_AUTH_ERROR) and 50 (MAX_LIMIT) and to explain the reasons for SDK login failures on the console:
205
+ - Error code 50: The number of daily active users (DAU) has exceeded the upper limit; the number of online users has exceeds the upper limit; the number of monthly active users (MAU) has exceeded the upper limit.
206
+ - Error code 2: The token is invalid.
207
+ - Adds success and failure callbacks (Promise) for the execution of the following methods:
208
+ - addContact: Adds a contact.
209
+ - deleteContact: Deletes a contact.
210
+ - acceptContactInvite: Accepts a friend request.
211
+ - declineContactInvite: Rejects a friend request.
212
+ - addUsersToBlocklist: Adds a friend to the block list.
213
+ - removeUserFromBlocklist: Removes a friend from the block list.
214
+
215
+ ## 4.1.5 (April 13, 2023)
216
+
217
+ - Adds four parameters, `from`, `msgTypes`, `startTime`, and `endTime` in `searchOptions` in the ` getHistoryMessages` method to allow you to retrieve historical messages from the server by message sender, message type, or period.
218
+
219
+ Adds The error code 511, MESSAGE_SIZE_LIMIT, to notify you when the size of the message body exceeds the upper limit.
220
+
221
+ ## 4.1.4 (Mar 16, 2023)
222
+
223
+ - Add Group Member Attributes feature
224
+ - Fix `getHistoryMessages` catch error failed
225
+ - Optimize the implementation of chat room join and leave to improve performance
226
+ - Add `deliverOnlineOnly` field in the message creation parameters
227
+
228
+ ## 4.1.3 (Feb 20, 2023)
229
+
230
+ - `getConversationlist` Getting the conversation list supports paging
231
+ - Group notification event added `op: create`
232
+ - `useOwnUploadFun` Self-uploaded images support the `size` field
233
+ - ios miniapp multi-device login kick failed
234
+ - Alipay mini program reconnection failed
235
+ - Fixes HIM-8557- Important -- getConversationlist api returns missing fields
236
+ - Added interface to check if you are on the chat room mute list
237
+ - Login failures caused by authentication are not retried
238
+
239
+ ## 4.1.2 (Nov 7, 2022)
240
+
241
+ - Chat room message priority
242
+ - Added unidirectional delete roaming function
243
+ - Create a group, Modify group information, Support 'ext' fields
244
+ - Optimize the timing of trigger message send failures
245
+ - 'muteGroupMembers' api supports blocking multiple users at the same time
246
+ - Fix Attachment message file_length field is invalid
247
+
248
+ ## 4.1.1 (Sep 26, 2022)
249
+
250
+ - Fix chat room KV
251
+ - Fix miniCore uploadFile method
252
+ - miniCore support 'isHttpDns' = false
253
+
254
+ ## 4.1.0 (Sep 16, 2022)
255
+
256
+ - SDK modular split
257
+ - Chat room KV
258
+ - Add log callback
259
+ - Add in-line comments
260
+ - Fix file upload failure without callback error
261
+ - `getJoinedGroups` supports getting your own roles
262
+ - Fix the compatibility with Internet Explorer
263
+ - Fixed bug where UniApp could not find 'addEventListener' when running on the phone
264
+ - Optimize reconnection logic
265
+
266
+ ## 4.0.9 (July 29, 2022)
267
+
268
+ - Add disaster preparedness strategies
269
+ - Optimize protocols to reduce data volume
270
+ - Fixed message delay in some cases
271
+ - Add a resourceId to the group and chat room APIs
272
+ - The getJoinedGroups API allows you to return the number of group members and their roles
273
+
274
+ ## 4.0.8 (Jun 17, 2022)
275
+
276
+ - 'GetGroupInfo' supports bulk query
277
+ - Add group event:onGroupEvent
278
+ - Add chatroom event:onChatroomEvent
279
+ - Add the limit when sending group messages
280
+ - Invite to join the group callback returns the group name
281
+
282
+ ## 4.0.7 (May 25, 2022)
283
+
284
+ - Add chatThread feature
285
+ - Add the API to the session list to parse the last message
286
+ - Modify the implementation of obtaining roaming messages
287
+ - Add the mark of offline message in the message
288
+
289
+ ## 4.0.5 (May 15, 2022)
290
+
291
+ - Add reporting API for content auditing
292
+ - Add push setting API to support different push configuration
293
+ - Add the data reporting function
294
+ - The API for getting groups that you have joined supports paging
295
+ - When creating a group, the SDK supports setting the number of group members
296
+ - Add thumbnail address parameter to receive picture message
297
+ - Fixed group chat message cache issues
298
+
299
+ ## 4.0.4 (April 19, 2022)
300
+
301
+ - Add presence feature
302
+ - Add translation feature
303
+ - Optimizing miniProgram does not require the isHttpDNS parameter
304
+ - Fixed failure to modify desc when creating a group
305
+ - Fixed SSR compatibility
306
+ - Fixed uni_SDK not running in browser
307
+
308
+ ## 4.0.3 (January 19, 2022)
309
+
310
+ - Fixed 'renewtoken' failed to replace the token
311
+ - Add 'downloadGroupSharedFile' api
312
+ - 'fetchGroupSharedFileList' supports paging
313
+
314
+ ## 4.0.2 (January 14, 2022)
315
+
316
+ - Add delete session api
317
+ - Add field 'buildingName' to the location message
318
+ - Add restrictions on messages sent by non-friends
319
+ - Add the error event of sending failure due to global mute
320
+ - Support DD mini program
321
+ - Fixed alipay mini program login problem
322
+ - Fixed missing onChannelMessage callback
323
+ - Fixed some known bugs
324
+
325
+ ## 4.0.1 (December 10, 2021)
326
+
327
+ - 4.0.1 version init
package/Easemob-chat.d.ts CHANGED
@@ -274,6 +274,10 @@ export declare namespace EasemobChat {
274
274
  * <br> This parameter has an impact on the kicking policy during a multi-device login scenario.
275
275
  */
276
276
  isFixedDeviceId?: boolean;
277
+ /** Custom platform, optional values [1-100]. Please refer to the multi device login document for details. */
278
+ customOSPlatform?: number;
279
+ /** Customize device name. The device name can only be set through this parameter after configuring customOSPlatform. */
280
+ customDeviceName?: string;
277
281
  };
278
282
 
279
283
  interface RegisterUserResult extends AsyncResult {
@@ -551,6 +555,8 @@ export declare namespace EasemobChat {
551
555
  public: boolean;
552
556
  /** Whether on the blacklist. */
553
557
  shieldgroup: boolean;
558
+ /** The group avatar. */
559
+ avatar: string;
554
560
  }
555
561
 
556
562
  interface ModifyGroupResult {
@@ -564,6 +570,8 @@ export declare namespace EasemobChat {
564
570
  membersonly?: boolean;
565
571
  /** Whether the permission invitation is modified successfully. */
566
572
  allowinvites?: boolean;
573
+ /** Whether the group avatar is changed successfully. -`true`: Yes; -`false`: No. */
574
+ avatar?: boolean;
567
575
  }
568
576
 
569
577
  type GroupMember = { owner: UserId } | { member: UserId };
@@ -739,7 +747,7 @@ export declare namespace EasemobChat {
739
747
  name?: string;
740
748
  /** The description of a group. */
741
749
  description?: string;
742
- /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `listgroups`. */
750
+ /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `getPublicGroups`. */
743
751
  public?: boolean;
744
752
  /** Whether a user requires the approval from the group owner or admin to join the group. -`true`: Yes; -`false`: No. */
745
753
  approval?: boolean;
@@ -756,6 +764,8 @@ export declare namespace EasemobChat {
756
764
  ext?: string;
757
765
  /** Last Modified Timestamp. */
758
766
  lastModified?: number;
767
+ /** The group avatar. */
768
+ avatar?: string;
759
769
  }
760
770
 
761
771
  // The group api result end.
@@ -1420,6 +1430,11 @@ export declare namespace EasemobChat {
1420
1430
  */
1421
1431
  USER_NOT_FRIEND = 221,
1422
1432
 
1433
+ /** No permission to download file. */
1434
+ WEBIM_DOWNLOADFILE_ERROR_NO_PERMISSION = 222,
1435
+ /** The file has expired. */
1436
+ WEBIM_DOWNLOADFILE_ERROR_EXPIRED = 223,
1437
+
1423
1438
  /** get DNS failed */
1424
1439
  SERVER_GET_DNSLIST_FAILED = 304,
1425
1440
 
@@ -2641,11 +2656,13 @@ export declare namespace EasemobChat {
2641
2656
  data: {
2642
2657
  /** The group name. */
2643
2658
  groupname: string;
2659
+ /** The group avatar. */
2660
+ avatar?: string;
2644
2661
  /** The description of the group. */
2645
2662
  desc: string;
2646
2663
  /** The array of member IDs to add to the group. These users will be added directly into the group and receive "operation: 'directJoined'" in the callback of onGroupEvent. */
2647
2664
  members: UserId[];
2648
- /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `listgroups`. */
2665
+ /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `getPublicGroups`. */
2649
2666
  public: boolean;
2650
2667
  /** Whether a user requires the approval from the group admin to join the group. -`true`: Yes; -`false`: No.*/
2651
2668
  approval: boolean;
@@ -2668,11 +2685,13 @@ export declare namespace EasemobChat {
2668
2685
 
2669
2686
  /**
2670
2687
  * Creates group
2688
+ * @deprecated Use {@link createGroupVNext instead.}
2671
2689
  *
2672
2690
  * ```typescript
2673
2691
  * connection.createGroup({
2674
2692
  data: {
2675
2693
  groupname: 'groupname',
2694
+ avatar: 'avatar',
2676
2695
  desc: 'this is my group',
2677
2696
  members: ['user1', 'user2'],
2678
2697
  public: true,
@@ -2690,11 +2709,13 @@ export declare namespace EasemobChat {
2690
2709
  data: {
2691
2710
  /** The group name. */
2692
2711
  groupname: string;
2712
+ /** The group avatar. */
2713
+ avatar?: string;
2693
2714
  /** The description of the group. */
2694
2715
  desc: string;
2695
2716
  /** The array of member IDs to add to the group. These users will be added directly into the group and receive "operation: 'directJoined'" in the callback of onGroupEvent. */
2696
2717
  members: UserId[];
2697
- /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `listgroups`. */
2718
+ /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `getPublicGroups`. */
2698
2719
  public: boolean;
2699
2720
  /** Whether a user requires the approval from the group admin to join the group. -`true`: Yes; -`false`: No.*/
2700
2721
  approval: boolean;
@@ -2715,6 +2736,54 @@ export declare namespace EasemobChat {
2715
2736
  }
2716
2737
  ): Promise<AsyncResult<CreateGroupResult>>;
2717
2738
 
2739
+ /**
2740
+ * Creates a group instance.
2741
+ *
2742
+ * ```typescript
2743
+ * connection.createGroupVNext({
2744
+ * groupName: 'groupname',
2745
+ * avatar: 'group avatar',
2746
+ * description: 'this is my group',
2747
+ * members: ['user1', 'user2'],
2748
+ * isPublic: true,
2749
+ * needApprovalToJoin: false,
2750
+ * allowMemberToInvite: true,
2751
+ * inviteNeedConfirm: false,
2752
+ * maxMemberCount: 200,
2753
+ * extension: JSON.stringify({info: 'group info'})
2754
+ * })
2755
+ * ```
2756
+ */
2757
+ createGroupVNext(
2758
+ this: Connection,
2759
+ params: {
2760
+ /** The group name. */
2761
+ groupName?: string;
2762
+ /** The group avatar. */
2763
+ avatar?: string;
2764
+ /** The description of the group. */
2765
+ description?: string;
2766
+ /** The array of member IDs to add to the group. These users will be added directly into the group and receive "operation: 'directJoined'" in the callback of onGroupEvent. */
2767
+ members?: UserId[];
2768
+ /** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `getPublicGroups`. */
2769
+ isPublic?: boolean;
2770
+ /** Whether a user requires the approval from the group admin to join the group. -`true`: Yes; -`false`: No.*/
2771
+ needApprovalToJoin?: boolean;
2772
+ /** Whether to allow group members to invite others to the group. `true`: Allow; `false`: Do not allow.*/
2773
+ allowMemberToInvite?: boolean;
2774
+ /**
2775
+ * Whether the invitee needs to accept the invitation before joining the group.
2776
+ * - `true`: The invitee's consent is required. The default value is `true`.
2777
+ * - `false`: The invitee will be directly added to the group without confirmation.
2778
+ */
2779
+ inviteNeedConfirm?: boolean;
2780
+ /** The group max users. */
2781
+ maxMemberCount?: number;
2782
+ /** Group detail extensions which can be in the JSON format to contain more group information. */
2783
+ extension?: string;
2784
+ }
2785
+ ): Promise<AsyncResult<{ groupId: string }>>;
2786
+
2718
2787
  /** @deprecated Use {@link blockGroupMessages instead.} */
2719
2788
  blockGroup(
2720
2789
  this: Connection,
@@ -2912,6 +2981,8 @@ export declare namespace EasemobChat {
2912
2981
  groupName?: string;
2913
2982
  /** The group description. */
2914
2983
  description?: string;
2984
+ /** The group avatar. */
2985
+ avatar?: string;
2915
2986
  /** Group detail extensions which can be in the JSON format to contain more group information. */
2916
2987
  ext?: string;
2917
2988
  success?: (res: AsyncResult<ModifyGroupResult>) => void;
@@ -7379,6 +7450,8 @@ export declare namespace EasemobChat {
7379
7450
  thumbnailWidth?: number;
7380
7451
  /** The thumbnail height. */
7381
7452
  thumbnailHeight?: number;
7453
+ /** Whether the image is a gif. */
7454
+ isGif?: boolean;
7382
7455
  }
7383
7456
 
7384
7457
  interface AudioParameters {