webman 框架使用 GatewayWorker 心跳超时时间设置 70 但是还是60秒掉线
<?php
use Webman\GatewayWorker\Gateway;
use Webman\GatewayWorker\BusinessWorker;
use Webman\GatewayWorker\Register;
return [
'gateway' => [
'handler' => Gateway::class,
'listen' => 'hex://0.0.0.0:6688',
'count' => cpu_count(),
'reloadable' => false,
'constructor' => ['config' => [
'lanIp' => '127.0.0.1',
'startPort' => 2300,
'pingInterval' => 70,
'pingNotResponseLimit'=> 1,
'pingData' => '',
'registerAddress' => '127.0.0.1:1236',
'onConnect' => function(){},
]]
],
'WebSocketTask' => [
'handler' => Gateway::class,
'listen' => 'websocket://0.0.0.0:6699',
'count' => cpu_count(),
'reloadable' => false,
'constructor' => ['config' => [
'lanIp' => '127.0.0.1',
'startPort' => 2320,
'pingInterval' => 80,
'pingNotResponseLimit'=> 1,
'pingData' => '',
'registerAddress' => '127.0.0.1:1236',
'onConnect' => function(){},
]]
],
'worker' => [
'handler' => BusinessWorker::class,
'count' => cpu_count()*2,
'constructor' => ['config' => [
'eventHandler' => plugin\webman\gateway\Events::class,
'name' => 'BusinessWorker',
'registerAddress' => '127.0.0.1:1236',
]]
],
'register' => [
'handler' => Register::class,
'listen' => 'text://127.0.0.1:1236',
'count' => 1, // Must be 1
'constructor' => []
],
];
WebSocketTask=>
'pingInterval' => 80,
设置70 80秒,都是60秒掉线
linux系统
设置成55 一般都一分钟内啊
设置成了70,我想让客户端60秒发送一次
这是服务端给客户端发送的时间
也是服务器关闭客户端连接的时间
手册让心跳间隔小于60秒,因为整个链路的路由器、防火墙、甚至nginx一般都会清理60秒内不活跃的连接。
按照手册来,别设置成70秒,给自己找麻烦
好吧,听人劝,吃饱饭,那我就设置成60秒,客户端55秒发送一次心跳吧(。^▽^)
我设置的客户端40秒 服务器端55秒 第二天会掉线。。。。