This commit is contained in:
2020-09-04 00:41:33 +08:00
parent 622071256e
commit 46f9de1f6a
141 changed files with 105 additions and 73 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace HttpServer\Events;
use Exception;
use HttpServer\Events\Abstracts\Callback;
use Snowflake\Event;
use Snowflake\Exception\ComponentException;
use Snowflake\Snowflake;
use Swoole\Server;
/**
* Class OnPipeMessage
* @package HttpServer\Events
*/
class OnPipeMessage extends Callback
{
/**
* @param Server $server
* @param int $src_worker_id
* @param $message
* @throws ComponentException
* @throws Exception
*/
public function onHandler(Server $server, int $src_worker_id, $message)
{
// TODO: Implement onHandler() method.
$events = Snowflake::app()->getEvent();
if (!$events->exists(Event::PIPE_MESSAGE)) {
return;
}
$events->trigger(Event::PIPE_MESSAGE, [$server, $src_worker_id, $message]);
}
}