Swoole\Server->on('Timer', fn)

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

Declaration

<?php Swoole\Server->on('Timer', Callable $callback)

Parameters

event

The event callback name.

callback

Callable event function.

Return

success

If success, it returns true, otherwise it returns false.

Depreciation.

Description

Execute the callback function when receiving Timer tick events.

A Timer can be added to the server with $server->addTimer method.

Example

<?php
function(Swoole\Server $server, int $interval)
{
  // ...
}
Last updated on August 31, 2022