Skip to content

Add support for custom payloads and channels in broadcasting#54099

Merged
taylorotwell merged 6 commits into
laravel:11.xfrom
JanneDeVos:feature/multi-channel-payload-broadcasting
Jan 9, 2025
Merged

Add support for custom payloads and channels in broadcasting#54099
taylorotwell merged 6 commits into
laravel:11.xfrom
JanneDeVos:feature/multi-channel-payload-broadcasting

Conversation

@JanneDeVos

Copy link
Copy Markdown
Contributor

This pull request introduces support for broadcasting events to multiple channels and connections with specific payloads for each connection. The changes include:

BroadcastEvent Class Enhancements:

  • Added methods to handle broadcasting to multiple connections and channels.
  • Implemented logic to format and send payloads specific to each connection.

Test Cases:

  • Added new test cases in BroadcastEventTest to verify the functionality of broadcasting to multiple channels and connections.
  • Ensured existing tests are updated to reflect the new broadcasting logic.

@taylorotwell taylorotwell merged commit ab7cdf6 into laravel:11.x Jan 9, 2025
@bram-pkg

Copy link
Copy Markdown
Contributor

This is a breaking change!!! @taylorotwell

Say I have a connection named apn and my event emits a payload of

return [
  'apn' => [
    'name' => 'Bram',
  ],
];

After this update, my event will actually only emit [ 'name' => 'Bram' ] rather than the whole payload.

Basically this change disallows for broadcasting any key that matches the current connection name, which is definitely a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants