Skip to content

Commit

Permalink
update connections after handling messages
Browse files Browse the repository at this point in the history
  • Loading branch information
joedixon committed Dec 29, 2023
1 parent add4d46 commit bd77a9f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Servers/ApiGateway/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public function handle(Request $request): void
try {
match ($request->event()) {
'CONNECT' => $this->server->open(
$this->connect($request)
$connection = $this->connect($request)
),
'DISCONNECT' => $this->server->close(
$this->connect($request),
),
'MESSAGE' => $this->server->message(
$this->connect($request),
$request->message()
$connection = $request->message()
),
};
} catch (InvalidApplication $e) {
Expand All @@ -51,6 +51,10 @@ public function handle(Request $request): void
$e
);
}

if (isset($connection)) {
app()->terminating(fn () => app(ConnectionManager::class)->update($connection));
}
}

/**
Expand Down

0 comments on commit bd77a9f

Please sign in to comment.