first commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Server\Handler;
|
||||
|
||||
use Annotation\Inject;
|
||||
use Server\Abstracts\Server;
|
||||
use Exception;
|
||||
use Server\SInterface\OnPipeMessageInterface;
|
||||
use Kiri\Events\EventDispatch;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class OnPipeMessage extends Server
|
||||
{
|
||||
|
||||
|
||||
/** @var EventDispatch */
|
||||
#[Inject(EventDispatch::class)]
|
||||
public EventDispatch $eventDispatch;
|
||||
|
||||
|
||||
/**
|
||||
* @param \Swoole\Server $server
|
||||
* @param int $src_worker_id
|
||||
* @param mixed $message
|
||||
* @throws Exception
|
||||
*/
|
||||
public function onPipeMessage(\Swoole\Server $server, int $src_worker_id, mixed $message)
|
||||
{
|
||||
if (!is_object($message) || !($message instanceof OnPipeMessageInterface)) {
|
||||
return;
|
||||
}
|
||||
call_user_func([$message, 'process'], $server, $src_worker_id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user