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

Notice: the documentation is suitable for PHP extension swoole until v4.7.1, we only support PHP extension openswoole from v4.7.1

Declaration

<?php
Swoole\Server->on('BeforeReload', 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 before the server reloads included files gracefully. Swoole can automatically reload any included files inside worker processes so that code changes can take place without interrupting server requests. This event is triggered just before all worker processes will be reloaded, read more about how to setup hot code reloading here.

This callback is triggered inside the manager process.

Since version 4.5.0

Example

<?php
$server->on('BeforeReload', function(Swoole\Server $server)
{
  // ...
});