Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

affan502's avatar

way to properly setup Laravel-echo authentication for private channels

I tried a lot but still can not setup properly LaravelEcho. Actually i unable to setup authentication step.The private channel are not authenticating. here is larave-echo CLI result https://ibb.co/cd5MfR

Boostrap.js

/**
 * Echo exposes an expressive API for subscribing to channels and listening
 * for events that are broadcast by Laravel. Echo and event broadcasting
 * allows your team to easily build robust real-time web applications.
 */

import Echo from "laravel-echo"

// window.Pusher = require('pusher-js');
window.io = require('socket.io-client');

window.Echo = new Echo({
    broadcaster: 'socket.io',
    host: 'http://localhost:6001'
});

Layout.blade.php

Echo.private('App.User.'+id)
                .notification((notification) => {
                    console.log(notification);
  });

laravel-echo-server.json

{
    "authHost": "http://bigplan.com",
    "authEndpoint": "/broadcasting/auth",
    "clients": [
        {
            "appId": "*********",
            "key": "*************************"
        }
    ],
    "database": "redis",
    "databaseConfig": {
        "redis": {
            "port": "6379",
            "host": "localhost"
        },
        "sqlite": {
            "databasePath": "/database/laravel-echo-server.sqlite"
        }
    },
    "devMode": false,
    "host": "localhost",
    "port": "6001",
    "protocol": "http",
    "referrers": [],
    "sslCertPath": "",
    "sslKeyPath": "",
    "verifyAuthPath": true,
    "verifyAuthServer": false
}
0 likes
0 replies

Please or to participate in this conversation.