Skip to content

sagarankoliya/laravel-event-broadcasting-socket.io

Repository files navigation

Laravel Events Broadcasting with Redis and Laravel Echo

Here I have showing you that how to work with broadcast your events over a WebSocket connection.


System Requirements

The following are required to function properly.

Getting Started

Step : 1

git clone https://github.com/sagarankoliya/laravel-event-broadcasting-socket.io.git

Step : 2

Go to project directory using Terminal / CMD

composer install

Step : 3

In project directory find .env.example and rename to .env

Generate laravel application key

php artisan key:generate

Also change in .env

BROADCAST_DRIVER=redis

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

Step : 4

install Node dependencies

npm install

Step : 5

Run Project

php artisan serve

Step : 6

Open project directory in second Terminal / CMD

laravel-echo-server start

Open http://127.0.0.1:8000 url in multipal brower

than after click Call Event button from any of browser screen, alert will show on all browsers, that is your response.

One client broadcasting an event and all connected client Subscribe an event.

Thats it.

Feel free to contact me if you have any query. (^_^)

Releases

No releases published

Packages

No packages published