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

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.

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)
{
  // ...
}