From 51a94fea195432c900e2429c2a4dca74c89a478a Mon Sep 17 00:00:00 2001 From: GitProtogen Date: Fri, 6 Mar 2026 17:05:54 +0100 Subject: [PATCH] token system now fullly works --- bin/WebSocketServer.php | 4 +- public/index.php | 138 ++++++++++++++++++++++++++++++++-------- 2 files changed, 112 insertions(+), 30 deletions(-) diff --git a/bin/WebSocketServer.php b/bin/WebSocketServer.php index 0e2f229..a009161 100644 --- a/bin/WebSocketServer.php +++ b/bin/WebSocketServer.php @@ -98,6 +98,7 @@ class WebSocketServer implements MessageComponentInterface public function onError(ConnectionInterface $conn, \Exception $e): void { echo "Error: {$e->getMessage()}\n"; + $this->deleteGivenId($conn->resourceId); $this->onClose($conn); } } @@ -109,8 +110,7 @@ $routes->add("ws", new Route("/ws", ["_controller" => new WsServer(n $server = IoServer::factory( new HttpServer(new Router(new UrlMatcher($routes, new RequestContext()))), - 8080, - "0.0.0.0" + 8080 ); Handler::getInstance()->init(); diff --git a/public/index.php b/public/index.php index 172f1ce..1dd8046 100644 --- a/public/index.php +++ b/public/index.php @@ -5,46 +5,128 @@ require __DIR__ . '/../vendor/autoload.php'; use ComCen\Html\Html; $html = new Html(); -$html->content .= " +$html->content = <<<'HTML' - + - - Chat + + ComCen + -

WebSocket Test

-
- - - +

ComCen

+ + +
+ + +
+ +
+ +
+ + +
-"; + +HTML; $html->renderContent();