From 73af447ece0791e6843a645719bf7b4a3685e2bb Mon Sep 17 00:00:00 2001 From: Joe Dixon Date: Wed, 15 Nov 2023 14:19:39 +0000 Subject: [PATCH] handle closing connections --- src/HttpServer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/HttpServer.php b/src/HttpServer.php index 1225ac9f..bd17e455 100644 --- a/src/HttpServer.php +++ b/src/HttpServer.php @@ -34,7 +34,7 @@ public function __invoke(ConnectionInterface $connection) $connection->on('data', function ($data) use ($connection) { $this->handleRequest($data, $connection); }); - // $conn->on('close', function () use ($conn) { + // $connection->on('close', function () use ($connection) { // $this->handleEnd($conn); // }); // $conn->on('error', function (\Exception $e) use ($conn) { @@ -66,6 +66,7 @@ protected function handleRequest(string $data, Conn $connection) $server->open($reverbConnection); $connection->on('message', fn (string $message) => $server->message($reverbConnection, $message)); + $connection->on('close', fn () => $server->close($reverbConnection)); return; }