This commit is contained in:
2026-04-17 14:41:13 +08:00
parent e5ab97dd5a
commit 4ae3001fe3
4 changed files with 277 additions and 212 deletions
+23 -4
View File
@@ -8,14 +8,33 @@ use Swoole\Http\Response;
class Struct
{
public int $userId;
public int $fd;
public int $connectedAt;
public int $lastSeenAt;
public AuthorizationInterface $user;
public Request $request;
public Response $ws;
public Request $request;
public Response $ws;
public function __construct(AuthorizationInterface $user, Request $request, Response $ws)
{
$this->user = $user;
$this->request = $request;
$this->user = $user;
$this->ws = $ws;
$this->ws = $ws;
$this->userId = $user->getUniqueId();
$this->fd = (int)($request->fd ?? 0);
$this->connectedAt = time();
$this->lastSeenAt = $this->connectedAt;
}
public function touch(): void
{
$this->lastSeenAt = time();
}
}