Skip to content

Commit

Permalink
Omit the socket_id key from the payload, unless a socket_id exists
Browse files Browse the repository at this point in the history
  • Loading branch information
larswolff committed Dec 5, 2024
1 parent 87ae4fd commit c514d7f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Protocols/Pusher/EventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ public static function dispatch(Application $app, array $payload, ?Connection $c
return;
}

app(PubSubProvider::class)->publish([
$data = [
'type' => 'message',
'application' => serialize($app),
'payload' => $payload,
'socket_id' => $connection?->id(),
]);
];
if ($connection?->id() !== null) {
$data['socket_id'] = $connection?->id();
}
app(PubSubProvider::class)->publish($data);
}

/**
Expand Down

0 comments on commit c514d7f

Please sign in to comment.