laravel-websockets icon indicating copy to clipboard operation
laravel-websockets copied to clipboard

does it work in laravel 8 and php 8?

Open maritojhefi opened this issue 3 years ago • 13 comments

I am trying to implement websockets in a laravel 8 project but I have several drawbacks

maritojhefi avatar Aug 23 '21 06:08 maritojhefi

It works. Could you explain the issue?

michelvambattu avatar Aug 25 '21 08:08 michelvambattu

No it will not work. Will get an error Channels current state is unavailable.

sreerajlal avatar Aug 28 '21 10:08 sreerajlal

I subscribe to the question. This is a really great package. I have used it in several of my projects. But now I have problems installing laravel-websockets on laravel latest version.

This is what I get when I run composer require beyondcode / laravel-websockets:

Using version ^1.12 for beyondcode/laravel-websockets
./composer.json has been updated
Running composer update beyondcode/laravel-websockets
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - beyondcode/laravel-websockets[1.12.0, ..., 1.x-dev] require guzzlehttp/psr7 ^1.5 -> found guzzlehttp/psr7[1.5.0, ..., 1.x-dev] but the package is fixed to 2.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.
    - Root composer.json requires beyondcode/laravel-websockets ^1.12 -> satisfiable by beyondcode/laravel-websockets[1.12.0, 1.x-dev].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Let's try with the --with-all-dependencies option:

Using version ^1.12 for beyondcode/laravel-websockets
./composer.json has been updated
Running composer update beyondcode/laravel-websockets --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires laravel/framework ^8.54, found laravel/framework[v8.54.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Ok, let's try to install the second version. Although it is still in beta.

./composer.json has been updated
Running composer update beyondcode/laravel-websockets
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - beyondcode/laravel-websockets[2.0.0-beta.28, ..., 2.x-dev] require guzzlehttp/psr7 ^1.5 -> found guzzlehttp/psr7[1.5.0, ..., 1.x-dev] but the package is fixed to 2.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.
    - beyondcode/laravel-websockets[2.0.0-beta.1, ..., 2.0.0-beta.29] require php ^7.2 -> your php version (8.0.10) does not satisfy that requirement.
    - Root composer.json requires beyondcode/laravel-websockets ^2.0 -> satisfiable by beyondcode/laravel-websockets[2.0.0-beta.1, ..., 2.x-dev].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

And now with the --with-all-dependencies option:

./composer.json has been updated
Running composer update beyondcode/laravel-websockets --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires laravel/framework ^8.54, found laravel/framework[v8.54.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.

As you can see, the situation has not changed at all.

I already wrote that I really like this package, but why is it so difficult to install it? You need to be more flexible in dealing with dependencies.

Can someone provide a working instruction for installing laravel-websockets on laravel v8.x + php v8.x?

Thanks!

another-universe avatar Aug 30 '21 22:08 another-universe

@maritojhefi @sreerajlal @another-universe have anyone got success in laravel 8

i am tring to install beyondcode / laravel-websockets-demo but getting error

D:\xampp\htdocs\laravel-websockets-chat>composer update Loading composer repositories with package information Updating dependencies Your requirements could not be resolved to an installable set of packages.

Problem 1 - Root composer.json requires php ^7.1.3 but your php version (8.0.9) does not satisfy that requirement. Problem 2 - laravel/framework[v5.7.0, ..., 5.7.x-dev] require php ^7.1.3 -> your php version (8.0.9) does not satisfy that requirement. - Root composer.json requires laravel/framework 5.7.* -> satisfiable by laravel/framework[v5.7.0, ..., 5.7.x-dev].

please reply

singhsanjay5151 avatar Sep 03 '21 12:09 singhsanjay5151

@singhsanjay5151 Yes, I managed to install it. I have installed beyondcode/laravel-websockets v2 on laravel v8.

composer require -w "beyondcode/laravel-websockets:^2.0"

Please note that in this case the guzzlehttp / psr7 version will be downgraded to 1.8.2. Also, if you are using the doctrine/dbal v3.x package, it will also be downgraded to 2.13.2. Otherwise, I have not noticed any unwanted side effects. By the way, I checked that beyondcode/laravel-websockets v1.x is also installed in the same way. But personally, I decided to stay on version 2, despite the fact that version 2 is still in beta. At least I have no complaints about the functioning at the moment.

another-universe avatar Sep 03 '21 19:09 another-universe

Is this even still maintained? There are 111+ issues right now. I'm using Laravel Jetstream with Livewire.

alexiovay avatar Sep 08 '21 18:09 alexiovay

Honestly, it's really painful for me after worked 3 hours but still failed to solve the problems when using this package with the latest Laravel version.

In the end, I ended up using Laravel Echo Server, and pulling the docker image, just configure a little bit then it's running without any issue. Not a great idea, but it works more for my case. Although I'm not really sure if there's any trade-off.

arbiyanto avatar Sep 08 '21 19:09 arbiyanto

Duplicate of / see https://github.com/beyondcode/laravel-websockets/issues/784 for a potential resolution. (The question will be whether the forced downgrade of guzzlehttp/psr7 causes problems elsewhere.)

tibbsa avatar Sep 15 '21 17:09 tibbsa

Problem 1

  • Root composer.json requires php ^7.1.3 but your php version (8.0.9) does not satisfy that requirement. Problem 2
  • laravel/framework[v5.7.0, ..., 5.7.x-dev] require php ^7.1.3 -> your php version (8.0.9) does not satisfy that requirement.
  • Root composer.json requires laravel/framework 5.7.* -> satisfiable by laravel/framework[v5.7.0, ..., 5.7.x-dev].

IMO, the errors are pretty clear?

  • You are using php8 while that project, you are quoting, requires php 7.1.X.
  • 2ndly, you claim that you are going to test laravel 8 but you r using laravel-framework 5.x?

mondwan avatar Sep 25 '21 07:09 mondwan

Hello,

Laravel 8 and websockets v1 work pretty well but indeed a downgrade of some packages is needed.

Deleting the composer.lock and running the following command will make websockets work correctly in Laravel 8:

composer require -W beyondcode/laravel-websockets

However do note that if you will be doing this in an already started project, there are chances that you will break something by forcing a package downgrade.

m33ts4k0z avatar Oct 19 '21 05:10 m33ts4k0z

thanks

Thanks & Regards Er. Sanjay Singh (Software Developer at Software xprts services pvt. ltd. https://www.softwarexprts.com/) Mo: 09098108694 Mo: 09755811276

On Tue, 19 Oct 2021 at 10:58, m33ts4k0z @.***> wrote:

Hello,

Laravel 8 and websockets v1 works pretty well but indeed a downgrade of some packages is needed.

Deleting the composer.lock and running the following command will make websockets work correctly in Laravel 8:

composer require -W beyondcode/laravel-websockets

However do note that if you will be doing this in an already started project, there are chances that you will break something by forcing a package downgrade.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/beyondcode/laravel-websockets/issues/838#issuecomment-946378737, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK27Q4R2O2JSA5GGFFHHWRDUHT6XXANCNFSM5CT26OKA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

singhsanjay5151 avatar Oct 21 '21 06:10 singhsanjay5151

  1. Switch to this package https://github.com/soketi/pws

  2. Then upgrade your pusher in composer from v3 to v7 which supports php 8 or

composer remove pusher/pusher-php-server <--- remove v3
composer install pusher/pusher-php-server <--- install v7

Ghustavh97 avatar Oct 22 '21 12:10 Ghustavh97

hello is not workng help

mcribz avatar Feb 25 '22 11:02 mcribz