Skip to content

Latest commit

 

History

History
45 lines (25 loc) · 1.24 KB

README.md

File metadata and controls

45 lines (25 loc) · 1.24 KB

laravel-redis-socket

Send real time notification to the user using laravel, redis and socket.io and without database

First, after clone you have to create one virtual host.

Install packages

npm install express ioredis socket.io --save

composer require predis/predis

Setting up Redis

As mentioned above Redis should already be installed but you just need to edit your .env file to tell Laravel to use the correct BROADCAST_DRIVER. Add the following line.

BROADCAST_DRIVER=redis

Starting the Servers

Open two command line tabs and SSH into Homestead

cd into the root directory of your project

In the first tab, run node socket.js You should see "Listening on Port 3000"

In the second tab run redis-server --port 3001 You should see a lot of output

Trying it out

Open up two browser windows side by side and in the first one hit the URL:

http://your-project-name.app/fire

And in the second:

http://your-project-name.app/test

Keep refreshing the first window and you should see the second page's content increment.

You're all done!

If you are stuck somewhere then call me:

[email protected] (+91 9558335853)