Comments (4)
但是当我在server.php的settings中增加了这个配置
配置文件发一下。
我看了一下源码。有这个帧,不过WebSocket Server封装时候没有把这个帧返回给回调,你可以通过修改class_map或者其他方式,改一下看看。
from hyperf.
你的这个文件是当server是协程时才会启动,而我的项目是'mode' => SWOOLE_PROCESS,
配置文件如下
[
'mode' => SWOOLE_PROCESS,
'servers' => [
[
'name' => 'ws',
'type' => ServerInterface::SERVER_WEBSOCKET,
'host' => '0.0.0.0',
'port' => (int)env('WS_PORT'),
'sock_type' => SWOOLE_SOCK_TCP,
'callbacks' => [
Event::ON_HAND_SHAKE => [Hyperf\WebSocketServer\Server::class, 'onHandShake'],
Event::ON_MESSAGE => [Hyperf\WebSocketServer\Server::class, 'onMessage'],
Event::ON_CLOSE => [Hyperf\WebSocketServer\Server::class, 'onClose'],
],
'settings' => [
Constant::OPTION_OPEN_WEBSOCKET_CLOSE_FRAME => true,
]
]
],
'settings' => [
Constant::OPTION_ENABLE_COROUTINE => true,
Constant::OPTION_WORKER_NUM => isOnlyStartAdmin() ? 2 : (int)env('OPTION_WORKER_NUM', swoole_cpu_num()),
Constant::OPTION_PID_FILE => BASE_PATH . '/runtime/hyperf.pid',
Constant::OPTION_OPEN_TCP_NODELAY => true,
Constant::OPTION_MAX_COROUTINE => (int)env('MAX_COROUTINE', 100000),
Constant::OPTION_OPEN_HTTP2_PROTOCOL => true,
Constant::OPTION_MAX_REQUEST => (int)env('OPTION_MAX_REQUEST', 0),
Constant::OPTION_SOCKET_BUFFER_SIZE => 2 * 1024 * 1024,
Constant::OPTION_BUFFER_OUTPUT_SIZE => 2 * 1024 * 1024,
Constant::OPTION_HEARTBEAT_CHECK_INTERVAL => 2 * 60,
Constant::OPTION_HEARTBEAT_IDLE_TIME => 10 * 60,
Constant::OPTION_DOCUMENT_ROOT => BASE_PATH . '/public',
Constant::OPTION_ENABLE_STATIC_HANDLER => true,
Constant::OPTION_DAEMONIZE => (int)env('OPTION_DAEMONIZE', 0),
Constant::OPTION_OPEN_WEBSOCKET_CLOSE_FRAME => true,
],
'callbacks' => [
Event::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
Event::ON_PIPE_MESSAGE => [Hyperf\Framework\Bootstrap\PipeMessageCallback::class, 'onPipeMessage'],
Event::ON_WORKER_EXIT => [Hyperf\Framework\Bootstrap\WorkerExitCallback::class, 'onWorkerExit'],
],
]
我在server里和顶级的settings加了这个配置,并且在启动sever时打印配置已经生效了 并通过swooleServer->set进行了配置 但是onMessage里还是拿不到关闭帧,也就拿不到code了
from hyperf.
Related Issues (20)
- 源码根目录,运行时会成一个0字节文件名为0的文件 ,怎么查找是那生成的?
- [BUG] composer update更新symfony相关包后,访问任意路由出现Not Found,#[Inject]的部分类在启动服务时会出现must not be accessed before initialization HOT 26
- [BUG] server:watch的 php 版本问题
- [BUG] hyperf/swagger 组件 HttpServer类 getHtml()方法中的 https://unpkg.hyperf.wiki 会报 421 Misdirected Request 导致生成的swagger接口文档白屏 HOT 2
- [QUESTION] 当使用Snowflake是数据库十八位ID,输出后精度不对 HOT 2
- golang 的jsonrpc不能调用hyperf的jsonrpc服务 请问如何解决? HOT 3
- [BUG] HOT 4
- [FEATURE] apm 有什么推荐,swoole那个不维护了。需要监控 到方法 ,内存,cpu HOT 1
- [QUESTION] Code coverage with proxy class HOT 5
- [BUG] Database table _meta renamed to _metum HOT 1
- [QUESTION] HOT 1
- [QUESTION] 请问是否不提供或则不支持 orderbyRow 自定义原生排序 且支持复杂子查询 HOT 1
- [QUESTION] Hyperf 框架中使用分表时关联关系查询报错的问题 HOT 3
- [BUG] json字段,update时Array to string conversion HOT 1
- [QUESTION] JsonRPC + Zipkin 无法追踪到请求微服务后的链路 HOT 8
- [FEATURE] 修复 Alpine Docker 环境下打包不能使用watcher.
- [BUG] hyperf/validation 不支持 exclude_unless 规则 HOT 1
- php7.4 [hyperf/validation] misses `extra` field HOT 2
- 启动websocket,在heartbeat_check_interval时间之内有收到消息, 但服务端断开了 HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hyperf.