easemob-websdk 4.0.8 → 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/CHANGELOG.md +10 -1
- package/Easemob-chat.d.ts +2903 -661
- package/Easemob-chat.js +1 -1
- package/package.json +1 -1
- package/readme.md +15 -11
package/package.json
CHANGED
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.
|
|
13
|
+
2. 引入SDK。
|
|
14
14
|
|
|
15
15
|
```
|
|
16
|
-
import
|
|
16
|
+
import EC from 'easemob-websdk'
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
3、初始化 SDK
|
|
20
20
|
|
|
21
|
-
```
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
```
|
|
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
|
-
```
|
|
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 =
|
|
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)
|