ЁЯФ╕ English:

Laravel Echo is like a listener on the frontend. When something happens on the server (like a new message, order placed, or status updated), Echo listens for that event and updates the UI instantly тАФ without refreshing the page.

ЁЯФ╕ Hindi:

Laravel Echo рдПрдХ JavaScript рд▓рд╛рдЗрдмреНрд░реЗрд░реА рд╣реИ рдЬреЛ real-time events рдХреЛ browser рдореЗрдВ рд╕реБрдирддреА рд╣реИред рдЬреИрд╕реЗ рд╣реА server рдкрд░ рдХреЛрдИ event trigger рд╣реЛрддрд╛ рд╣реИ (рдЬреИрд╕реЗ рдирдпрд╛ рдореИрд╕реЗрдЬ рдЖрдпрд╛, order confirm рд╣реБрдЖ), Echo рдЙрд╕реЗ рдкрдХрдбрд╝рддрд╛ рд╣реИ рдФрд░ рдкреЗрдЬ рдХреЛ reload рдХрд┐рдП рдмрд┐рдирд╛ UI рдХреЛ update рдХрд░ рджреЗрддрд╛ рд╣реИред

тЬЕ Real-World Example:

ЁЯОп Use Case:

You have a chat application built in Laravel. When User A sends a message, User B should see it immediately without refreshing.

Laravel Echo lets you do that by:

  1. Broadcasting the message from Laravel backend.
  2. Listening for the event using Echo in frontend.
  3. Automatically updating the chat window.
  1. Listen on Frontend (using Echo in JavaScript)
jsCopyEditimport Echo from 'laravel-echo';

window.Pusher = require('pusher-js');

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: 'your-pusher-key',
    cluster: 'mt1',
    forceTLS: true
});

Echo.channel('chat')
    .listen('NewMessage', (e) => {
        console.log(e.message);
    });