kakajansh / echo

Laravel Echo for your Flutter apps.
MIT License
107 stars 68 forks source link

How to change Event default Namespace to listen ? #43

Closed Toe-Tet closed 3 years ago

Toe-Tet commented 3 years ago

Hello, I want to listen from Laravel default Notification event. When I looked for it, it comes from "Illuminate\Notifications\Events\BroadcastNotificationCreated".

And, This is my code to listen.

echo.private('private-App.Models.Admin.xxxxxxxxxx').listen( 'Illuminate.Notifications.Events.BroadcastNotificationCreated', (e) { print(e); print(11); });

But, the echo is binding to "App\Events\Illuminate\Notifications\Events\BroadcastNotificationCreated".

How can I remove "App\Events" default namespace.

Thank you !

Toe-Tet commented 3 years ago

I got an answer for my issues. When I looked in "channel.dart" file in "laravel_echo" package, I found notification function that leads to '.Illuminate\Notifications\Events\BroadcastNotificationCreated'.

So I write a code like this.

echo.private('private-App.Models.Admin.xxxxxxxxxx').notification((e) { print(e); print(11); });