easemob-websdk 4.0.3 → 4.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easemob-websdk",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
4
4
  "description": "Easemob chat websdk",
5
5
  "main": "Easemob-chat",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -1,50 +1,53 @@
1
- # 环信IM SDK介绍
1
+ # 环信 IM SDK 介绍
2
2
 
3
- sdk提供完整的即时消息功能开发功能,屏蔽/封装并阻止其内部复杂的细节,并提供相对简单和简洁的API接口,以方便第三方应用程序快速集成PC/mobile Web应用程序的即时消息功能
4
- -----------
3
+ ## sdk 提供完整的即时消息功能开发功能,屏蔽/封装并阻止其内部复杂的细节,并提供相对简单和简洁的 API 接口,以方便第三方应用程序快速集成 PC/mobile Web 应用程序的即时消息功能
5
4
 
6
5
  ## 可以通过以下方式引用 WebSDK:
7
6
 
8
7
  1. 安装
8
+
9
9
  ```
10
10
  npm install easemob-websdk --save
11
11
  ```
12
12
 
13
13
  2. 先引入,再访问 WebIM。
14
+
14
15
  ```
15
16
  import websdk from 'easemob-websdk'
16
17
  ```
17
18
 
18
- 3、初始化SDK
19
+ 3、初始化 SDK
20
+
19
21
  ```js
20
- const WebIM = {}
21
- const conn = WebIM.conn = new websdk.connection({
22
- appKey: 'your app key'
23
- })
22
+ const WebIM = {};
23
+ const conn = (WebIM.conn = new websdk.connection({
24
+ appKey: 'your app key',
25
+ }));
24
26
  ```
25
27
 
26
28
  4、登录环信服务
29
+
27
30
  ```js
28
- const options = {
29
- user: 'username',
30
- pwd: 'password'
31
+ const options = {
32
+ user: 'username',
33
+ pwd: 'password',
31
34
  };
32
35
  conn.open(options);
33
36
  ```
37
+
34
38
  5、发送消息
39
+
35
40
  ```js
36
- let id = conn.getUniqueId()
41
+ let id = conn.getUniqueId();
37
42
  let msg = new WebIM.message('txt', id);
38
43
  msg.set({
39
- msg: 'message content',
40
- to: 'username',
41
- chatType: 'singleChat',
42
- success: function () {
43
- console.log('send private text Success');
44
- },
45
- fail: function(e){ }
44
+ msg: 'message content',
45
+ to: 'username',
46
+ chatType: 'singleChat',
47
+ success: function () {
48
+ console.log('send private text Success');
49
+ },
50
+ fail: function (e) {},
46
51
  });
47
52
  conn.send(msg.body);
48
-
49
53
  ```
50
-