Skip to content

Commit 521c8e9

Browse files
author
neo
committed
update readme
1 parent 6e8420e commit 521c8e9

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ yarn add mixin-node-sdk
1818
```
1919

2020
## Usage
21+
1. Use Mixin Api
2122
```js
2223
const {Client} = require('mixin-node-sdk')
2324
const client = new Client({
@@ -37,8 +38,28 @@ async function getMe() {
3738
console.log(me)
3839
}
3940
```
41+
2. Use Mixin's message
42+
```js
43+
const {BlazeClient} = require('mixin-node-sdk')
44+
const client = new BlazeClient({
45+
"client_id": "",
46+
"session_id": "",
47+
"pin_token": "",
48+
"private_key": "",
49+
"pin": "",
50+
"client_secret": ""
51+
}, {parse: true, syncAck: true})
52+
53+
client.loopBlaze({
54+
onMessage(msg){
55+
console.log(msg)
56+
},
57+
})
4058

4159

60+
```
61+
> BlazeClient directly inherits Client, so all Client methods BlazeClient can be called directly.
62+
4263

4364
## Note
4465
1. If you are using the version of `[email protected]`, please see [https://github.com/liuzemei/mixin-node-sdk](https://github.com/liuzemei/mixin-node-sdk)

README.zh-CN.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ yarn add mixin-node-sdk
1616
```
1717

1818
## 使用
19+
1. 仅使用 Mixin 的 Api
1920
```js
2021
const { Client } = require('mixin-node-sdk')
2122
const client = new Client({
@@ -36,6 +37,28 @@ async function getMe() {
3637
}
3738
```
3839

40+
2. 使用 Mixin 的消息功能()
41+
```js
42+
const { BlazeClient } = require('mixin-node-sdk')
43+
const client = new BlazeClient({
44+
"client_id": "",
45+
"session_id": "",
46+
"pin_token": "",
47+
"private_key": "",
48+
"pin": "",
49+
"client_secret": ""
50+
}, {parse: true, syncAck: true})
51+
52+
client.loopBlaze({
53+
onMessage(msg){
54+
console.log(msg)
55+
},
56+
})
57+
58+
59+
```
60+
> BlazeClient 直接继承了 Client,所以所有 Client 的方法 BlazeClient 都可以直接调用。
61+
3962

4063

4164
## 注意

0 commit comments

Comments
 (0)