php8.5
Home/ Manual/ swoole / event/ Swoole\Event::dispatch

Swoole\Event::dispatch

PHP function Edit on GitHub ✎

Perform a single event loop iteration

Description

Swoole\Event::dispatch(): void

The purpose of this function is to maintain compatibility with some frameworks. When a framework internally manages its own reactor loop, using Event::wait would allow Swoole's underlying layer to retain control, preventing the framework from taking over execution.

Return Values

No return value.

Examples

Manual event loop control

php
<?php
while (true) {
    Swoole\Event::dispatch();
}

Source: reference/swoole/swoole/event/dispatch.xml · from the official PHP manual (php/doc-en)