Files
fdesk/plugin/webman/gateway/Events.php
T
2025-10-11 08:41:11 +00:00

39 lines
793 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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)
{
self::$wsEvents->logout($client_id);
var_dump('关闭客户端ID:'.$client_id);
}
}