Echo is incompatible with BROADCAST_CONNECTION=ably
Echo Version
2.2.0
Laravel Version
12.25.0
PHP Version
8.4.11
NPM Version
PNPM 10.15.0
Database Driver & Version
No response
Description
I tried setting up broadcasting with Ably according to the docs: https://laravel.com/docs/12.x/broadcasting.#client-ably. After following all steps and debugging, I concluded that Laravel ably driver is incompatible with Echo.
The problem is:
- Laravel
ablydriver broadcasts toprivate:broadcast(colon). laravel-echolibrary subscribes toprivate-broadcast(hyphen).
In order to fix this, Echo should use colons when subscribing to Ably. For the purpose of confirming that this approach would work, I edited PusherConnector in Echo source locally. I replaced colons to hyphens and Echo started working as expected.
Steps To Reproduce
- Follow Laravel docs to setup broadcasting with Ably.
- Setup basic front-end for testing.
- Run the queue using
sail artisan queue:workor similar. - Set
Pusher.logToConsole = true;. - Test using the front-end. You will see that Ably does not return anything.
- Check front-end logs in the console. The subscribed endpoint uses a hyphen.
- Check Ably dev console using their web client. Laravel uses a colon to broadcast with
BROADCAST_CONNECTION=ably.
Hey there, thanks for reporting this issue.
We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here?
Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.
laravel new bug-report --github="--public"
Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.
Thanks!
Hello,
Did you enable pusher compatibility on Ably's project settings?