改名
This commit is contained in:
@@ -4,14 +4,35 @@
|
||||
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
|
||||
{
|
||||
|
||||
public function onHandler()
|
||||
/**
|
||||
* @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::get()->getEvent();
|
||||
if (!$events->exists(Event::PIPE_MESSAGE)) {
|
||||
return;
|
||||
}
|
||||
$events->trigger(Event::PIPE_MESSAGE, [$server, $src_worker_id, $message]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ class Event extends BaseObject
|
||||
const EVENT_STOP = 'WORKER:STOP';
|
||||
const EVENT_EXIT = 'WORKER:EXIT';
|
||||
|
||||
const PIPE_MESSAGE = 'SERVER:PIPE:MESSAGE';
|
||||
|
||||
const EVENT_AFTER_REQUEST = 'SERVER:REQUEST:AFTER:START';
|
||||
const EVENT_BEFORE_REQUEST = 'SERVER:REQUEST:BEFORE:START';
|
||||
const RECEIVE_CONNECTION = 'SERVER:RECEIVE:CONNECTION';
|
||||
|
||||
Reference in New Issue
Block a user