Appearance
Events, Broadcasting and Push ​
Overview ​
The backend has 7 event classes in app/Events and 3 listeners in app/Listeners. Four events are broadcast to the frontends over private channels for real-time badge counts, announcements and subscription state. Two events are plain server-side events with a listener. Two event classes are not used anywhere.
There is no app/Notifications folder, so Laravel Notifications are not used. Mobile push goes through the custom App\PushNotification\PushNotification class, which calls Firebase Cloud Messaging directly.
Event to listener mapping ​
Mappings are explicit in app/Providers/EventServiceProvider.php. shouldDiscoverEvents() returns false, so auto-discovery is off and a new listener must be added to $listen.
| Event | Listener | Queued | What the listener does |
|---|---|---|---|
Illuminate\Auth\Events\Registered | Illuminate\Auth\Listeners\SendEmailVerificationNotification | no | Laravel default. |
App\Events\UpdateSubscriptionRestrictionEvent | App\Listeners\UpdateSubscriptionRestrictionListener | yes (ShouldQueue) | Loads the workspace's SubscriptionUsers. When the dam_branding feature is off it resets WorkspaceBranding to the default colours (#070E22 / #ffffff) and is_branding = 0; when email_branding is off it sets is_branding = 0. |
App\Events\GetUserSubscriptionEvent | App\Listeners\GetUserSubscriptionListener | yes (ShouldQueue) | handle() is empty. The useful work is the broadcast (below). |
Illuminate\Mail\Events\MessageSending | App\Listeners\ApplyWorkspaceMailToMessage | no | Sets the workspace From address on white-label mail, or cancels the send when white label is on without SMTP details. See Mail. |
SocialiteProviders\Manager\SocialiteWasCalled | SocialiteProviders\Microsoft\MicrosoftExtendSocialite@handle | no | Registers the Microsoft Socialite driver. |
The queued listeners run on the default queue of the default connection, since neither sets $queue or $connection.
Event inventory ​
| Event | Broadcast | Fired from | Notes |
|---|---|---|---|
ProjectUserNotificationBadgesEvent | ShouldBroadcastNow | SendDamEmailSystemNotificationJob, ConvertAssetsJob, AnnouncementNotification job; Web\Subscription\SubscriptionController (2), Api\v1\DigitalAssets\DamNotificationController, Api\v1\Announcement\AnnouncementController, DAM\v1\Digital\AssetProductOrderController | Pushes updated notification badge counts to an admin user. |
DAMFrontendAnnouncement | ShouldBroadcastNow | AnnouncementNotification job, DAM\v1\Digital\AnnouncementController | Pushes a new announcement badge to a portal user. |
GetUserSubscriptionEvent | ShouldBroadcastNow | dam:existing-user-apply-plan command | Tells the user whether a plan is now assigned. Also has a (no-op) queued listener. |
UpdateSubscriptionRestrictionEvent | no | Api\v1\Auth\AuthController, DAM\v1\Auth\AuthController (on login, for the requested workspace) | Has a broadcastOn() returning update-subscription-restriction-channel, but it does not implement ShouldBroadcast, so nothing is broadcast. Handled by its queued listener. |
LogoutDealershipUser | ShouldBroadcastNow | No caller found | Would force-logout a portal user on logoutDealershipUser.{userId}. |
PrivateEvent | ShouldBroadcastNow | No caller found | Sample event on user.{id}, payload id, name. |
PubLicEvent | no | No caller found | Laravel stub (channel-name). |
Broadcast events ​
All four broadcast events implement ShouldBroadcastNow, so they are sent during the request or job that fires them, not through the queue. All use PrivateChannel.
| Event | Channel | broadcastAs | Payload (broadcastWith) |
|---|---|---|---|
ProjectUserNotificationBadgesEvent | private-user.{loginUserId}.projectBatchNotification | ProjectUserNotificationBadgesEvent | data (badge counts: project_badges_count, lm_badges_count, dam_badges_count, and so on), origin_url |
DAMFrontendAnnouncement | private-user.{loginUserId}.DAMFrontendAnnouncementNotification | DAMFrontendAnnouncement | data (badge data) |
GetUserSubscriptionEvent | private-user.{userId}.getUserSubscriptionChannel | GetUserSubscriptionEvent | plan_assign (true when the workspace's SubscriptionUsers.features is set) |
LogoutDealershipUser | private-logoutDealershipUser.{userId} | logoutDealershipUser | data (the event data) |
PrivateEvent | private-user.{id} | privateEvent | id, name |
GetUserSubscriptionEvent::broadcastWith() has a side effect: it writes event_sent (1 or 0) on the SubscriptionUsers row and saves it.
Clients subscribe with the name after the private- prefix, for example user.42.projectBatchNotification, and listen for the broadcastAs name with a leading dot.
Driver ​
The broadcaster is BROADCAST_DRIVER in config/broadcasting.php, defaulting to null. The config defines pusher, ably, redis, log and null connections. Which one is set in each environment is not visible in the repo.
Channel authorization ​
App\Providers\BroadcastServiceProvider calls Broadcast::routes(['middleware' => ['auth:api,dam-api']]) (dd4df4a), which registers the /broadcasting/auth endpoint behind either the Passport api guard (Admin users) or dam-api (portal users), then loads routes/channels.php. Every channel callback allows the user only when the ID in the channel name equals the authenticated user's ID, and each channel names the one guard allowed to subscribe, because users.id and dealer_users.id overlap.
| Channel pattern | Guard | Used by |
|---|---|---|
App.User.{id} | api | Laravel default, no event uses it |
user.{id} | api | PrivateEvent |
user.{user_id}.projectBatchNotification | api | ProjectUserNotificationBadgesEvent |
user.{user_id}.DAMFrontendAnnouncementNotification | dam-api | DAMFrontendAnnouncement |
user.{user_id}.getUserSubscriptionChannel | api | GetUserSubscriptionEvent |
logoutDealershipUser.{user_id} | dam-api | LogoutDealershipUser |
The broadcasting auth route is listed with the other web routes in Web routes.
Push notifications ​
App\PushNotification\PushNotification sends mobile push messages to every DeviceToken.fcm_token of a user through the legacy FCM HTTP endpoint (https://fcm.googleapis.com/fcm/send, Authorization: key=...) with cURL. A user who has muted the module in MuteNotifications gets the message with no sound and normal priority; otherwise default sound and high priority. The badge number comes from ProjectUserNotificationBadges.
PushNotificationServiceProvider binds the class to the container key PushNotification, and config/app.php aliases the facade PushNotification to App\PushNotification\PushNotificationFacade. The provider is listed three times in config/app.php; the duplicates are harmless.
| Method | Server key | Purpose | Called from |
|---|---|---|---|
sendNotification(...) | FCM_SERVER_KEY env | Legacy PM module task push | No caller found |
sendReportNotification(...) | FCM_SERVER_KEY env | Legacy report push | No caller found |
sendLmNotification(...) | FCM_SERVER_KEY env | Legacy LM module push | No caller found |
static sendDamNotification(...) | constant.DAM_FCM_SERVER_KEY | DAM order status push to admins | No caller found |
static sendDamAnnouncementNotification($moduleId, $type, $title, $workspaceId, $userId) | constant.DAM_FCM_SERVER_KEY | DAM announcement push to portal users | AnnouncementNotification job, alongside the DAMFrontendAnnouncement broadcast |
Google shut down the legacy FCM send API in 2024, so these calls may no longer deliver. Moving to the FCM HTTP v1 API would need OAuth service-account credentials instead of a server key. This was not tested from the repo.