Topic for help to understand how broadcasting with Redis and Socket.IO works
Laravel echo server
Install
npm install -g laravel-echo-server
Initialize config file (from backend
folder)
laravel-echo-server init
You can see that the laravel-echo-server.json
file has been created. You don't need to change the default settings.
Please note: if your project is running not on
http://localhost
you need to set your host in Laravel.env
file inLARAVEL_ECHO_SERVER_AUTH_HOST
variableEx.
LARAVEL_ECHO_SERVER_AUTH_HOST=http://topspizza.test
Run server
pm2 start echosystem.config.js --only=laravelEcho
Laravel echo server documentation
Redis
Install on AlmaLinux
dnf install redis
Configure Laravel .env
file
BROADCAST_DRIVER=redis
QUEUE_CONNECTION=redis
Broadcasting
If you want to learn more about Laravel broadcasting, publish and private channels, how to work with echo on frontend, etc., you can check out the Laravel documentation https://laravel.com/docs/8.x/broadcasting