Unable to get notification broadcasted to pusher
First let me start by listing what I have done and tried. I have pretty much everything working with the exception of the event being sent to pusher, and I have looked here and on discord and while there are a few questions related to this, most are just dead since the OP never replied back.
-Pusher configuration is setup and correct
-Echo is setup
-Pusher SDK is installed
Upon saving a form, I am using this to dispatch the event:
I can see in my logs that the event fires up, and on the pusher dashboard I can see 3 events:
1.Connection
2.Subscribed
3.Occupied
But I am not able to see the actual event.
My config/filament.php file has the code below which I had it commented it out until my last 2 tries because I was initializing echo inside a custom js file that I am loading in my app layout file:
My custom js file has this:
Anyone has been able to successfully get the database notifications to work with pusher? I have them working with the default polling but cant get it to work with Echo/Websockets.
-Pusher configuration is setup and correct
-Echo is setup
-Pusher SDK is installed
Upon saving a form, I am using this to dispatch the event:
DatabaseNotificationsSent::dispatch($recipient); I also tried this first per the docs, but they should be equivalent event(new DatabaseNotificationsSent($recipient));I can see in my logs that the event fires up, and on the pusher dashboard I can see 3 events:
1.Connection
2.Subscribed
3.Occupied
But I am not able to see the actual event.
My config/filament.php file has the code below which I had it commented it out until my last 2 tries because I was initializing echo inside a custom js file that I am loading in my app layout file:
'broadcasting' => [
'echo' => [
'broadcaster' => 'pusher',
'key' => env('VITE_PUSHER_APP_KEY'),
'cluster' => env('VITE_PUSHER_APP_CLUSTER'),
'forceTLS' => true,
],
],My custom js file has this:
import Echo from 'laravel-echo';
import Pusher from 'pusher-js';
window.Pusher = Pusher;
window.Echo = new Echo({
broadcaster: 'pusher',
key: import.meta.env.VITE_PUSHER_APP_KEY,
cluster: import.meta.env.VITE_PUSHER_CLUSTER,
forceTLS: true
});
const userId = window.userId;
window.Echo.private(App.Models.User.${userId})
.listen('.database-notifications.sent', (e) => {
console.log("Event received:", e);
});
Anyone has been able to successfully get the database notifications to work with pusher? I have them working with the default polling but cant get it to work with Echo/Websockets.