This commit is contained in:
mzl
2025-08-20 13:46:59 +08:00
parent 2e94a17d11
commit 78e28a99dc
8 changed files with 440 additions and 2 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace plugin\webman\gateway;
use app\common\utils\WsEvents;
use GatewayWorker\Lib\Gateway;
class Events
{
protected static $wsEvents;
public static function onWorkerStart($worker)
{
self::$wsEvents = new WsEvents();
}
public static function onConnect($client_id)
{
// 仅 TCP 连接,不一定有 WebSocket 握手
}
public static function onWebSocketConnect($client_id, $data)
{
self::$wsEvents->auth($client_id, $data);
}
public static function onMessage($client_id, $message)
{
self::$wsEvents->message($client_id, $message);
}
public static function onClose($client_id)
{
var_dump('关闭客户端ID:'.$client_id);
}
}