Skip to content

Commit

Permalink
fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chaz6chez committed Jul 19, 2024
1 parent ef1ad41 commit a86b3bf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@
|-- config
|-- plugin
|-- webman-push-server
|-- app.php # 主配置信息
|-- bootstrap.php # 自动加载
|-- command.php # 支持命令
|-- log.php # 日志配置
|-- middleware.php # 基础中间件
|-- process.php # 启动进程
|-- redis.php # redis配置
|-- route.php # APIs路由信息
|-- app.php # 主配置信息
|-- bootstrap.php # 自动加载
|-- command.php # 支持命令
|-- log.php # 日志配置
|-- middlewares.php # 基础中间件
|-- process.php # 启动进程
|-- redis.php # redis配置
|-- route.php # APIs路由信息
```

### 频道说明
Expand Down Expand Up @@ -129,15 +129,15 @@ composer require workbunny/webman-push-server
- config/plugin/workbunny/webman-push-server/process.php中可调节启动进程数,默认为cpu count
- config/plugin/workbunny/webman-push-server/app.php中可配置心跳等参数
- config/plugin/workbunny/webman-push-server/redis.php中可配置redis连接信息
- config/plugin/workbunny/webman-push-server/middleware.php中可配置push-server消息中间件,可用于消息的拦截、过滤、路由等
- config/plugin/workbunny/webman-push-server/middlewares.php中可配置push-server消息中间件,可用于消息的拦截、过滤、路由等

#### api-server服务

- api-server服务用于监听http/https消息,对外提供REST风格的open-apis,API服务提供REST风格的http-APIs,接口内容与 [pusher-channel-api](https://pusher.com/docs/channels/library_auth_reference/rest-api/) 基本保持一致
- config/plugin/workbunny/webman-push-server/process.php中可调节启动进程数,默认为cpu count
- config/plugin/workbunny/webman-push-server/app.php中可配置流量统计间隔等参数
- config/plugin/workbunny/webman-push-server/route.php中为基础open-apis的实现
- config/plugin/workbunny/webman-push-server/middleware.php中可配置api-server消息中间件,可用于消息的拦截、过滤、路由等
- config/plugin/workbunny/webman-push-server/middlewares.php中可配置api-server消息中间件,可用于消息的拦截、过滤、路由等

##### open-apis列表:

Expand Down Expand Up @@ -572,7 +572,7 @@ class PushServerMiddleware
我们在使用过程中可能需要为push-server的onMessage做一些安全性考虑或者数据过滤和拦截的功能,那么消息中间件非常适合该场景

- 以拦截非websocket协议消息距离
- 在config/plugin/workbunny/webman-push-server/middleware.php中添加中间件回调函数
- 在config/plugin/workbunny/webman-push-server/middlewares.php中添加中间件回调函数

```php
// push server root middlewares
Expand Down
2 changes: 1 addition & 1 deletion src/ApiServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct()
{
static::setStatisticsInterval(static::getConfig('traffic_statistics_interval', 0));
// 加载中间件
if ($middlewares = \config('plugin.workbunny.webman-push-server.middleware.api-server', [])) {
if ($middlewares = \config('plugin.workbunny.webman-push-server.middlewares.api-server', [])) {
$mid = [];
foreach ($middlewares as $middleware) {
if (is_callable($middleware)) {
Expand Down
2 changes: 1 addition & 1 deletion src/PushServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function __construct()
intval(self::getConfig('heartbeat', 60))
);
// 加载中间件
if ($middlewares = \config('plugin.workbunny.webman-push-server.middleware.push-server', [])) {
if ($middlewares = \config('plugin.workbunny.webman-push-server.middlewares.push-server', [])) {
foreach ($middlewares as $middleware) {
if (is_callable($middleware)) {
$this->_middlewares[] = $middleware;
Expand Down

0 comments on commit a86b3bf

Please sign in to comment.