Skip to content

Commit

Permalink
Log close code & reason for websocket connection (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
Naneynonn committed Apr 5, 2024
1 parent 2576386 commit 76f02ff
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Websocket.php
Expand Up @@ -68,6 +68,10 @@ public function open(string $url): ExtendedPromiseInterface
$this->emit(WebsocketEvents::MESSAGE, [$message]);
});

$connection->on('close', function (int $code, string $reason = '') {
$this->logger->info('Connection closed', ['code' => $code, 'reason' => $reason]);
});

$resolver();
}, function (\Exception $e) use ($url, $reject) {
$this->logger->error(
Expand Down

0 comments on commit 76f02ff

Please sign in to comment.