gatewayworker 心跳

henry

start_gateway.php

// 心跳间隔
$gateway->pingInterval = 30;
$gateway->pingNotResponseLimit = 1;
 Events.php
public static function onWorkerStart($businessWorker)
{
    //print_r($businessWorker);
    if($businessWorker->id === 0){
        echo "进去定时器了哦\n";
        Timer::add(10, function() use ($businessWorker){
            echo "timer\n";
            Gateway::sendToGroup(321, '发送定时信息1');
        });
    }
}

心跳如上设置,然后客户端在16:34:25的时候连接到服务端,客户端从16:34:29-16:35:09收到了5条消息,这是为啥,心跳我只设置了30秒,怎么会保持了44秒呢,如附件的截图

3034 1 0
1个回答

walkor

这个心跳会有一些误差,是正常的。

年代过于久远,无法发表回答
🔝