Skip to content

Commit

Permalink
Increase depth limit and forego event in case of null (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
Exanlv authored May 15, 2024
1 parent 925352d commit e6cc773
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Gateway/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ public function __construct(
$this->meta = new Eventer();

$this->websocket->on(WebsocketEvents::MESSAGE, function (MessageInterface $message) {
$payload = $this->mapper->map(json_decode((string) $message), Payload::class);
$parsedMessage = json_decode((string) $message, depth: 1024);
if ($parsedMessage === null) {
return;
}

$payload = $this->mapper->map($parsedMessage, Payload::class);

$this->raw->emit((string) $payload->op, [$this, $payload, $this->logger]);
});
Expand Down

0 comments on commit e6cc773

Please sign in to comment.