I'm working on a chat system in laravel with pusher and Echo, my pusher is working fine, when I trigger the event it goes to pusher, here is my pusher debug console screen shot enter image description here
but when I'm unable to recieve the event or anything that shows me what error is on my chrome console, I have checked all the mistakes that discuss here, but again the same issue. Please check my code and tell me where I'm wrong. Thank You
.env file
BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=1d583e4e42f820
MAIL_PASSWORD=aeff887f7d1784
MAIL_ENCRYPTION=null
PUSHER_APP_ID= app id(this is just for demonstration)
PUSHER_APP_KEY= my app key (this is just for demonstration)
PUSHER_APP_SECRET= app secret (this is just for demonstration)
PUSHER_APP_CLUSTER=ap2
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
Echo initializing
import Echo from 'laravel-echo'
window.Pusher = require('pusher-js');
window.Echo = new Echo({
broadcaster: 'pusher',
key: 'my app key',
cluster: 'ap2',
encrypted: true
});
my app.js
window.Laravel = {'csrfToken': ''}
window.Echo.private('chat')
.listen('ChatEvent', (e) => {
console.log(e);
});
Thanks in Advance
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire