Real Time application using Laravel / Socket.IO / Redis

El Alami Anas
Mar 2 · 1 min read

The first issue i’ve faced is that to create real-time applications with laravel the most common tools is pusher and it’s expensive for a simple developer like me.

So like every developer we do search for opensource alternative, and the first thing that you could find is “Socket.IO” is a opensource library build on ExpressJS. “FEATURING THE FASTEST AND MOST RELIABLE REAL-TIME ENGINE” — socket.io website

So i’ve started testing a way to use Socket.IO along side Laravel, as a beginner i’ve encounter a lot of issues. but Laravel “Event” save my life also the easy implementation with “Redis” server

As first, i create a small test as always it didn’t work, but after small adjustments THE FIRST NOTIFICATION WORKS. i too was happy, that day i’ve done nothing.

Let’s start the real talk, first we need to set a NodeJS server file so we can run Socket.IO library and connect it to our Laravel Application.

then we need to add Socket.IO js Library to out Laravel application <script src =”https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js”>

and make sure that our Laravel Application is connected to Redis server, you can check https://laravel.com/docs/5.7/redis to check how to configure it

So now you should be able you create Real-time application Using Laravel ❤

Thanks you for the reading my post =)

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade