Skip to content

Commit 495853b

Browse files
committed
add readme
1 parent 71da4e5 commit 495853b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Websocket Client for WeChat Mini Programs
2+
3+
## About
4+
This plugin is built for developers using Adonis JS with Websockets enabled on the backend and WeChat Mini Programs on the frontend.
5+
6+
You can use all client APIs available in the official browser client (docs here):
7+
8+
[Adonis Websocket Client Docs](https://adonisjs.com/docs/websocket)
9+
10+
## Setup
11+
1. Install the package
12+
```
13+
npm install adonis-websocket-wechatmp
14+
```
15+
>You may freely use this NPM package in 3rd party frameworks like Taro, Wepy, MPVue, etc.
16+
>
17+
>Vanilla Framework: [NPM package install guide](https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html?t=18082018)
18+
19+
2. Then in your Mini Program project:
20+
>```/pages/page/page.js```
21+
>```javascript
22+
>import Ws from 'adonis-websocket-wechatmp'
23+
>const ws = Ws('ws:// -or- wss://your-url-here')
24+
>
25+
>Page({
26+
> data: {},
27+
> onLoad () {
28+
> // init websocket connection
29+
> }
30+
>})
31+
>```

0 commit comments

Comments
 (0)