2. Mitul
Golakiya
About Me
8+ Years of Experience in Laravel
Open Source Lover
Laravel Consultant
Programmer & Speaker by Passion
CEO & Founder At InfyOm
Technologies
4. Realtime Applications
• The new Era of realtime applications
• No on want to refresh a page
• Socket.io
• Node.js takeover
5. Use
CasesLaravel Echo can be used in
various use cases where we
need updates from Backend
Server.
Real-time Chatting
App
Chatting
Backend Notifications
System
Notifications
Realtime Updates
from Backend
Realtime Updates
An app where we need
realtime collobrations
Realtime
Collobration
7. Socket.io
Socket.io is a event-driven library which enables
real-time and full duplex communication between
the Client and the Web servers by using
WebSocket protocol.
• Node.js server
• Javascript Client side Library for browser
10. Laravel Broadcasting
• Possibility to send updates to frontend in
realtime
• Multiple connectors
• Socket.io with Echo Server with Redis
• Pusher
• Without leaving comfort of PHP & Laravel
• As simple as dispatching Laravel Events
15. Laravel Echo
Laravel Echo is a JavaScript library that makes it
painless to subscribe to channels and listen for
events broadcast by Laravel.
composer require pusher/pusher-php-server
"~4.0"
npm install –save laravel-echo pusher-js
composer require predis/predis
npm install –save socket.io-client
17. Channels
• Each application can have one channel or many,
and each client can choose which channels it
subscribes to.
• Channels provide a way of filtering data For
example, in a chat application there may be a
channel for people who want to discuss 'dogs’
• A way of controlling access to different streams of
information.
• Channels don't need to be explicitly created, and
areinstantiated on client demand.
18. Types of Channels
• Public channels can be subscribed to by anyone
who knows their name
• Private channels should have a private- prefix. They
introduce a mechanism which lets your server
control access to the data you are broadcasting
• Presence channels should have a presence- prefix
and are an extension of private channels. They let
you 'register' user information on subscription, and
let other members of the channel know who's
online.
19. Events
• Events are the primary method of packaging
messages in the Channels system. they form the
basis of all communication.
• They are essentially 'named messages' which means
you can set up 'handlers' in your client code to deal
with the various types.
• They are used for 'client-side' routing, and should
not be used as filters.
• Events can be seen as a notification of something
happening on your system, and they are often
named in the past tense.