PHPSocketIO好像默认带心跳,那么心跳超时触发的事件是哪个?
<?php
use Workerman\Worker;
use PHPSocketIO\SocketIO;
require_once './vendor/autoload.php';
$debug = true;
$io = new SocketIO(2020);
$io->on('connection', function() use ($socket) {
$socket->on('disconnect', function () {
echo "disconnect called" . PHP_EOL;
});
$socket->on('close', function () use ($socket) {
echo "has ok closed!" . PHP_EOL;
});
});
触发的是disconnect,还是close?
心跳不会触发什么事件,disconnect 是监测到连接断开后才触发
心跳的作用就是监测链接是否超时吧,如果超时了,是不是就监测到其链接断开了?