rainbow-websocket is an basic implement of websocket, including authorization、promise encapsulation、error handle ...
No. | feature | process |
---|---|---|
1 | 异常处理 与 错误码 | 👌 |
2 | 等待连接的请求处理 | 👌 |
3 | 推送通知 |
No. | feature | process |
---|---|---|
1 | 以Promise 的形式调用 |
👌 |
2 | 心跳机制 | |
3 | 鉴权 | |
4 | 请求拦截器 | 👌 |
# build all
$ npm run build
# esm
$ npm run build:esm
# cjs
$ npm run build:cjs
# umd
$ npm run build:umd
// esm
import RainbowWebsocket from 'rainbow-websocket'
// cjs
const RainbowWebsocket = require('rainbow-websocket')
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/rainbow-websocket.umd.js">
# websocket test server
npm run ws-server
# test page
npm run page-test