mercredi 26 avril 2017

Not Able to Broadcast notifications on Private Channel with Redis & Laravel 5.3

I am working on making a real-time notifications with Laravel-Redis-Socketio-LaravelEcho. So far, i am able to broadcast to pubic channel but stuck with private channel.
My bootstrap.js:

import Echo from "laravel-echo"

window.Echo = new Echo({
    broadcaster: 'socket.io',
    host: window.location.hostname + ':6001'
});

Laravel-echo-server.json:

"authHost": "http://localhost",
    "authEndpoint": "/broadcasting/auth",
    "clients": [
        {
            "appId": "",
            "key": ""
        }
    ],
    "database": "redis",
    "databaseConfig": {
        "redis": {},
        "sqlite": {
            "databasePath": "/database/laravel-echo-server.sqlite"
        }
    },
    "devMode": true,
    "host": null,
    "port": "6001",
    "protocol": "http",
    "socketio": {},
    "sslCertPath": "",
    "sslKeyPath": ""

In my notification class, i have broadcastOn() as:

public function broadcastOn() {
        return new PrivateChannel('my-channel');
    }

And my-client side is:

Echo.private('my-channel')
    .notification((notification) => {
        console.log('I am here');
    });

Everything is working fine with Public Channel but With Private Channel, command line shows the following after starting laravel-echo-server :

Error: Connect ECONNREFUSED 127.0.0.1:80. Error sending authentication request.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire