easemob-websdk 4.0.9 → 4.1.0-beta

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.9",
3
+ "version": "4.1.0-beta",
4
4
  "description": "Easemob chat websdk",
5
5
  "main": "Easemob-chat",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -6,28 +6,27 @@
6
6
 
7
7
  1. 安装
8
8
 
9
- ```
9
+ ```bash
10
10
  npm install easemob-websdk --save
11
11
  ```
12
12
 
13
- 2. 先引入,再访问 WebIM。
13
+ 2. 引入SDK。
14
14
 
15
15
  ```
16
- import websdk from 'easemob-websdk'
16
+ import EC from 'easemob-websdk'
17
17
  ```
18
18
 
19
19
  3、初始化 SDK
20
20
 
21
- ```js
22
- const WebIM = {};
23
- const conn = (WebIM.conn = new websdk.connection({
24
- appKey: 'your app key',
25
- }));
21
+ ```javascript
22
+ const conn = new EC.connection({
23
+ appKey: '<your app key>',
24
+ });
26
25
  ```
27
26
 
28
27
  4、登录环信服务
29
28
 
30
- ```js
29
+ ```javascript
31
30
  const options = {
32
31
  user: 'username',
33
32
  pwd: 'password',
@@ -37,14 +36,14 @@ conn.open(options);
37
36
 
38
37
  5、发送消息
39
38
 
40
- ```js
39
+ ```javascript
41
40
  let option = {
42
41
  chatType: 'singleChat', // 会话类型,设置为单聊。
43
42
  type: 'txt', // 消息类型。
44
43
  to: 'userID', // 消息接收方(用户 ID)。
45
44
  msg: 'message content', // 消息内容。
46
45
  };
47
- let msg = websdk.message.create(option);
46
+ let msg = EC.message.create(option);
48
47
  conn.send(msg)
49
48
  .then(() => {
50
49
  console.log('send private text Success');
@@ -53,3 +52,8 @@ conn.send(msg)
53
52
  console.log('Send private text error');
54
53
  });
55
54
  ```
55
+
56
+ ## 参考文档
57
+
58
+ - [Easemob Chat SDK 产品概述](https://docs-im.easemob.com/ccim/intro)
59
+ - [Easemob Chat SDK API 参考](https://docs-im.easemob.com/ccim/web/apireference)