laravel-websockets
laravel-websockets copied to clipboard
With Laravel Fremework 8.40 the deault websokect http://127.0.0.1:6001/ not open here
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...
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...
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.
So once you open this link http://localhost:8000/laravel-websockets, did it start working? It still didn't for me.
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.
- 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)