PHP 8 support (incompatible Pusher lib version)
Closed this issue ยท 8 comments
Hi!
Thanks for your work on this rad plugin ๐
I'd like to ask for PHP 8 support. statamic/collaboration requires pusher/pusher-php-server "~3.0", however PHP 8 support in this package was introduced in v4.1.5.
Would it be possible to migrate that dependency?
Ah, that's a good catch! I wonder if there's any breaking changes between v3 and v4 of the Pusher package.
We don't rely on 3.0 of pusher specifically, it's just that we copied the installation instructions from Laravel at the time.
Laravel 8 is currently suggesting 5.0. Laravel 7 was suggesting 4.0.
https://laravel.com/docs/8.x/broadcasting#pusher-channels
Go ahead and run composer require pusher/pusher-php-server "^5.0"
instead of what's on our docs. It might just work for you. We'll update the docs.
I've checked that with fresh local Statamic 3.1.14, Laravel 8.41.0, PHP 8.0.6 and both ^4.0 and ^5.0 versions of Pusher lib. Unfortunately, it's stuck on "Attempting websocket connection...".
I can see focus
and blur
events in the console, but nothing related to users.
Have you changed the BROADCAST_DRIVER
and the pusher keys in your .env
file?
@jasonvarga thanks for the tip. I pasted credentials to .env
, but later found out that placeholders were at the bottom of the file, overwriting my settings ;-)
I can confirm that the addon works on PHP 8 with Pusher lib v5.0.3.
When updating Docs, it would be also helpful to mention that the addon uses Client Events, which needs turning on in Pusher dashboard.
Thanks again!
Hello @jasonvarga. I have this same issue but not able to install version 5 of pusher.
When running composer require pusher/pusher-php-server:v5
i get the following error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires pusher/pusher-php-server v5 -> satisfiable by pusher/pusher-php-server[v5.0.0].
- pusher/pusher-php-server v5.0.0 requires psr/log ^1.0 -> found psr/log[1.0.0, ..., 1.1.4] but the package is fixed to 3.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
Even with the -W flag. Also I was able to install version 7.0 of pusher-php-server, but then get the same behaviour as @dmgawel like this:
Unfortunately, it's stuck on "Attempting websocket connection...".
I can see
focus
andblur
events in the console, but nothing related to users.
Any idea how to fix this?
@jasonvarga Yes, I've enabled that. In the console I see the following warning:
WebSocket connection to 'wss://ws.pusherapp.com/app/{{PUSHER_APP_KEY}}?protocol=7&client=js&version=4.4.0&flash=false' failed: WebSocket is closed before the connection is established.
*Where PUSHER_APP_KEY is the key retrieved out of the .env file.
When opening an entry it also shows some logs with ๐ฃ Broadcasting "chunked-blur" & ๐ฃ Broadcasting "chunked-focus" and the message 'Attempting websocket connection...' above the entry. So I thought maybe downgrading to 5.0 would fix it, but that was also not possible. All details are in the .env
file as well, App\Providers\BroadcastServiceProvider::class
is uncommented and BROADCAST_DRIVER=pusher
. Any idea what it could be?