Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/holytiny/feathersjs-wxmp-socket.io-client
:dragon: Feathersjs 框架的微信小程序websocket客户端
https://github.com/holytiny/feathersjs-wxmp-socket.io-client
feathersjs mini-program socket-io socket-io-client websocket-client wechat
Last synced: 3 months ago
JSON representation
:dragon: Feathersjs 框架的微信小程序websocket客户端
- Host: GitHub
- URL: https://github.com/holytiny/feathersjs-wxmp-socket.io-client
- Owner: holytiny
- License: mit
- Created: 2019-10-23T04:01:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-02T14:58:31.000Z (about 5 years ago)
- Last Synced: 2024-10-02T05:03:10.806Z (4 months ago)
- Topics: feathersjs, mini-program, socket-io, socket-io-client, websocket-client, wechat
- Language: JavaScript
- Homepage:
- Size: 26.9 MB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# feathersjs-socketio-wxmp-client
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)
Feathersjs框架的微信小程序websocket客户端。
## 使用说明
```shell script
npm install @holytiny/wxmp-socket.io-client --save
```
在client.js中
```js
import feathers from '@feathersjs/feathers';
import auth from '@feathersjs/authentication-client';
import feathersSocketioClient from '@feathersjs/socketio-client';
import io from '@holytiny/wxmp-socket.io-client';import Debug from 'debug';
if ('production'.localeCompare(process.env.NODE_ENV) !== 0) {
Debug.enable('*');
}
const debug = Debug('@feathersjs/socketio-client');export default function FeathersClient () {
debug('create socketio client');
const socketioInit = io('http://localhost:3030', {
transports: ['websocket'],
forceNew: true,
timeout: false
});const feathersClient = feathers();
//feathersClient.configure(feathersSocketioClient(socketioInit, { timeout: 1000 * 20 }));
feathersClient.configure(feathersSocketioClient(socketioInit));
feathersClient.configure(auth());return feathersClient;
}
```
在xxx.js中
```js
import FeathersClient from './client';
const feathersClient = FeathersClient();
```
具体使用请参考Feathersjs的[@feathersjs/socketio-client](https://docs.feathersjs.com/api/client/socketio.html)文档## @holytiny/wxmp-socket.io-client
[@holytiny/wxmp-socket.io-client](https://github.com/holytiny/feathersjs-wxmp-socket.io-client/tree/master/packages/wxmp-socket.io-client)是本项目的一个包,提供了[Socket.IO-client](https://socket.io/docs/client-api/)在微信小程序环境下的兼容版本。
这个包可以单独使用,具体请看[说明](https://github.com/holytiny/feathersjs-wxmp-socket.io-client/tree/master/packages/wxmp-socket.io-client#readme)。## License
[MIT](/LICENSE)