Skip to content

Commit

Permalink
Add meta disconnect event (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
Exanlv authored Nov 8, 2024
1 parent beb2c03 commit 44e465f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Gateway/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Ragnarok\Fenrir\Constants\WebsocketEvents;
use Ragnarok\Fenrir\DataMapper;
use Ragnarok\Fenrir\EventHandler;
use Ragnarok\Fenrir\Gateway\Events\Meta\MetaEvent;
use Ragnarok\Fenrir\Gateway\Handlers\HeartbeatAcknowledgedEvent;
use Ragnarok\Fenrir\Gateway\Handlers\IdentifyHelloEvent;
use Ragnarok\Fenrir\Gateway\Handlers\IdentifyResumeEvent;
Expand Down Expand Up @@ -104,6 +105,8 @@ private function registerEvents(): void

private function handleClose(int $code, string $reason): void
{
$this->meta->emit(MetaEvents::DISCONNECT, [$this, $this->logger]);

$this->stopAutomaticHeartbeats();

$description = GatewayCloseCodes::DESCRIPTIONS[$code] ?? sprintf('Unknown error code %d - %s', $code, $reason);
Expand Down

0 comments on commit 44e465f

Please sign in to comment.