ext-swooleis supported until v4.7.1, use
ext-openswoole>= v4.7.1. Latest version:
pecl install openswoole-4.9.1
<?php Swoole\Server->heartbeat(bool $ifCloseConnection = true): bool|array
Whether to close any detected timed out connections based on the server configuration options that are set.
If successful, an array of closed connection
fds are returned, otherwise if something went wrong or no connections are closed/found
false is returned instead.
This method is difference from the
heartbeat_check_interval server configuration, which is passive. The
heartbeat method actively checks all connections to see if they have exceeded the agreed heartbeat timeout set within the server configuration options.
By default, calling this method will close any idle connections but you can disable this by passing
<?php $closeFdArrary = $server->heartbeat(); var_dump($closeFdArrary);