Swoole Server getCallback()

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

Declaration

<?php Swoole\Server->getCallback(string $eventName)

Parameters

eventName

The event callback that you want to retrieve using the event name, no need to include on, just the name like Request, this relates to the server callback events

Return

success

If success, it returns the registered callback, otherwise it returns null.

Description

Get the callback function bind on a server event.

When the callback event has been registered with the server, this method will return what was registered, so it will return the four different event registration callback types: Closure, string or an array. If the callback does not exist it will return null.

Last updated on August 31, 2022