Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
joedixon committed Apr 4, 2024
1 parent 520163c commit a7a7e5c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Protocols/Pusher/EventHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ public function sendInternally(Connection $connection, string $event, array $dat
/**
* Format the payload for the given event.
*/
public function formatPayload(string $event, array $data = [], ?string $channel = null): string|false
public function formatPayload(string $event, array $data = [], ?string $channel = null, string $prefix = 'pusher:'): string|false
{
return json_encode(
array_filter([
'event' => 'pusher:'.$event,
'event' => $prefix.$event,
'data' => empty($data) ? null : json_encode($data),
'channel' => $channel,
])
Expand All @@ -164,7 +164,7 @@ public function formatInternalPayload(string $event, array $data = [], $channel
return json_encode(
array_filter([
'event' => 'pusher_internal:'.$event,
'data' => empty($data) ? '{}' : json_encode($data),
'data' => json_encode((object) $data),
'channel' => $channel,
])
);
Expand Down

0 comments on commit a7a7e5c

Please sign in to comment.