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

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

Declaration

<?php OpenSwoole\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(OpenSwoole\Server $server, int $interval)
{
  // ...
}
Last updated on September 1, 2022