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

With Laravel Fremework 8.40 the deault websokect http://127.0.0.1:6001/ not open here

Open wdraghwendra opened this issue 3 years ago • 4 comments

I did a fresh installation of Laravel framework and in composer.json added line this "beyondcode/laravel-websockets": "^1.12", . After that, I run the command "composer install" the packages installed successfully. here is the list of composer.json. "require": { "php": "^7.3|^8.0", "beyondcode/laravel-websockets": "^1.12", "billbee/billbee-api": "^1.9", "fideloper/proxy": "^4.4", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^6.5|^7.0.1", "laravel/framework": "^8.40", "laravel/tinker": "^2.5", "pusher/pusher-php-server": "^5.0" }, Then run this code from the command prompt

php artisan vendor:publish --provider="BeyondCode\LaravelWebSockets\WebSocketsServiceProvider" --tag="migrations"
php artisan migrate
php artisan vendor:publish --provider="BeyondCode\LaravelWebSockets\WebSocketsServiceProvider" --tag="config"
php artisan websockets:serve

After that, I am trying to open http://127.0.0.1:6001/ in the browser and it does not work. Can anyone please let me know what I did wrong? This is online showing in my command prompt screen Starting the WebSocket server on port 6001...

socet

wdraghwendra avatar Sep 14 '21 11:09 wdraghwendra

I did a fresh installation of Laravel framework and in composer.json added line this "beyondcode/laravel-websockets": "^1.12", . After that, I run the command "composer install" the packages installed successfully. here is the list of composer.json. "require": { "php": "^7.3|^8.0", "beyondcode/laravel-websockets": "^1.12", "billbee/billbee-api": "^1.9", "fideloper/proxy": "^4.4", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^6.5|^7.0.1", "laravel/framework": "^8.40", "laravel/tinker": "^2.5", "pusher/pusher-php-server": "^5.0" }, Then run this code from the command prompt

php artisan vendor:publish --provider="BeyondCode\LaravelWebSockets\WebSocketsServiceProvider" --tag="migrations"
php artisan migrate
php artisan vendor:publish --provider="BeyondCode\LaravelWebSockets\WebSocketsServiceProvider" --tag="config"
php artisan websockets:serve

After that, I am trying to open http://127.0.0.1:6001/ in the browser and it does not work. Can anyone please let me know what I did wrong? This is online showing in my command prompt screen Starting the WebSocket server on port 6001...

socet

I got the solution, I have to go on the link of localhost i.e. http://localhost:8000/laravel-websockets after running the laravel serve. So the WebSocket is working for Laravel 8.4x.

wdraghwendra avatar Sep 15 '21 04:09 wdraghwendra

So once you open this link http://localhost:8000/laravel-websockets, did it start working? It still didn't for me.

glupeksha avatar Sep 24 '21 05:09 glupeksha

It started working for me too, the problem was that jquery was not loading, after few refreshes It started working. Also I had to run this command php artisan websockets:serve --host=127.0.0.1 with the host.

glupeksha avatar Sep 24 '21 06:09 glupeksha

  • Firstly, according to my trials, you basically need to run 2 servers. One for websocket server, and one for web server in order to test the websocket. That's why the solution here is accessing http:....:8000/
  • 2ndly, laravel-websockets runs on local env only by default (Unless you made some changes)
    • https://beyondco.de/docs/laravel-websockets/debugging/dashboard#protecting-the-dashboard

But, information are kind of misleading here.

  • Websocket server is running on port 6001. Why you guys is able to access port 8000, and get this work?
    • So, I guess you are running another web server somehow on port 8000, which has not mentioned

Lastly, I guess laravel-websockets maybe able to access by http:....:6001/laravel-websockets since that websocket server is supposed to manage http access also according to the official blog (But, I have not tried by myself)

mondwan avatar Sep 25 '21 08:09 mondwan