Laravel Socket.io,Redis event is broadcasting but not showing on client side

Laravel Socket.io,Redis event is broadcasting but not showing on client side



In my laravel.log i can see the event is broadcasting on the channel i.e.


laravel.log


[2018-08-30 13:41:27] local.INFO: Broadcasting [AppEventsNewRating] on channels [rating] with payload:

"music":
"id": 42,
"name": "1535368873_admin.mp3",
"path": "public/music/1535368873_admin.mp3",
"rating": 53,
"user_id": 4,
"created_at": "2018-08-27 11:21:13",
"updated_at": "2018-08-27 11:21:13",
"is_last_played": 1,
"is_now_playing": 0,
"location_id": 1
,
"socket": null



As of i know i have done everything according to requirement.my redis server is running.laravel-echo-server is running and it is joining my channel i.e.


redis


laravel-echo-server


[18:41:24] - VX9bkHqs-QHRv3MvAAAC joined channel: rating



This is where i am subscribing to the channel and listening to the event


window.app = new Vue(
el: '#app',

beforeMount: function ()
alert("asdas");
this.joinPublicChatChannel();
,

methods:
joinPublicChatChannel: function ()
Echo.channel('rating').listen('App\Events\NewRating', (event) =>
console.log("Event fired!"); //This doesnt work
);


);



and this is my event class


class NewRating implements ShouldBroadcastNow
array
*/
public function broadcastOn()

return new Channel('rating');




and this is my env file


APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=laravel_restaurant
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=redis
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

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=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=



Dont know the reason behind :/



UPDATE



Just cleared all the caches, Now im getting this in laravel-echo-server console


laravel-echo-server


Channel: rating
Event: AppEventsNewRating
Channel: rating
Event: AppEventsNewRating
Channel: rating
Event: AppEventsNewRating




1 Answer
1



Never Mind, I got this running :). just cleared the caches and in


Echo.channel('rating').listen('App\Events\NewRating', (event) =>
console.log("Event fired!"); //This doesnt work
);



I used NewRating instead of App\Events\NewRating


NewRating


App\Events\NewRating



Required, but never shown



Required, but never shown






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

How do I collapse sections of code in Visual Studio Code for Windows?

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ