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

Declaration

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

Parameters

event

The event name

callback

callback function

Return

success

if success, it returns TRUE, otherwise it returns FALSE.

Description

This callback function is executed when a task is finished, the result senting back to the caller worker process.

You can also access to the result data in this callback function.

Callback function

<?php
function (Swoole\Server $server, int $task_id, mixed $data) {

}
  • $server the swoole server object
  • $task_id the id number of task
  • $data the result of task

Example