Skip to content

Commit fd6fcfa

Browse files
committed
fix: 修复默认配置错误
1 parent 16e835d commit fd6fcfa

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

README.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
# egg-websocket-plugin
22

33
[![NPM version][npm-image]][npm-url]
4-
[![build status][travis-image]][travis-url]
5-
[![Test coverage][codecov-image]][codecov-url]
6-
[![David deps][david-image]][david-url]
74
[![Known Vulnerabilities][snyk-image]][snyk-url]
85
[![npm download][download-image]][download-url]
96

107
[npm-image]: https://img.shields.io/npm/v/egg-websocket-plugin.svg?style=flat-square
118
[npm-url]: https://npmjs.org/package/egg-websocket-plugin
12-
[travis-image]: https://img.shields.io/travis/eggjs/egg-websocket-plugin.svg?style=flat-square
13-
[travis-url]: https://travis-ci.org/eggjs/egg-websocket-plugin
14-
[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-websocket-plugin.svg?style=flat-square
15-
[codecov-url]: https://codecov.io/github/eggjs/egg-websocket-plugin?branch=master
16-
[david-image]: https://img.shields.io/david/eggjs/egg-websocket-plugin.svg?style=flat-square
17-
[david-url]: https://david-dm.org/eggjs/egg-websocket-plugin
189
[snyk-image]: https://snyk.io/test/npm/egg-websocket-plugin/badge.svg?style=flat-square
1910
[snyk-url]: https://snyk.io/test/npm/egg-websocket-plugin
2011
[download-image]: https://img.shields.io/npm/dm/egg-websocket-plugin.svg?style=flat-square
@@ -56,7 +47,7 @@ app.ws.route('/ws', app.controller.home.hello);
5647
app.ws.route('/foo/:id', app.controller.home.foo);
5748
```
5849

59-
### 3. 配置全局中间件【可选】
50+
### 3. 配置 WebSocket 全局中间件【可选】
6051

6152
```js
6253
// app/router.js
@@ -83,7 +74,7 @@ function middleware(ctx, next) {
8374
app.ws.route('/ws', middleware, app.controller.home.hello);
8475
```
8576

86-
### 5. 禁用 app 全局中间件
77+
### 5. 禁用 App 全局中间件
8778

8879
> 插件默认会使用 app.use(...) 注册的中间件,如果你不想使用它们,或者这些插件与 websocket 有冲突,你可以在 `config.default.js` 中禁用它们
8980
@@ -108,7 +99,7 @@ export default class HomeController extends Controller {
10899
throw new Error('this function can only be use in websocket router');
109100
}
110101

111-
console.log(`clients: ${app.ws.clients.size}`);
102+
console.log('client connected');
112103

113104
ctx.websocket
114105
.on('message', (msg) => {

config/config.default.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
* @property {String} SOME_KEY - some description
77
*/
88
exports.websocket = {
9-
useAppMiddleware: true,
9+
useAppMiddlewares: true,
1010
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "egg-websocket-plugin",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Egg standard WebSocket plugin",
55
"eggPlugin": {
66
"name": "websocket"

0 commit comments

Comments
 (0)