requestStack->getCurrentRequest()->getSession()->get('mercure_alert_topic'); $update = new Update( $userAlertTopic, $this->renderer->render('broadcast/Alert.stream.html.twig', [ 'alert_id' => uniqid(), 'title' => $title, 'message' => $message, 'type' => $type, ]) ); $this->hub->publish($update); } catch (\Throwable $exception) { // ToDo: look for better handling to get message to end user } if (true === $sendPush && in_array($this->notificationTransport, ['ntfy'])) { try { $notification = new Notification($title, ['push'])->content($message); $this->notifier->send($notification); } catch (\Throwable $exception) { $this->logger->error('Unable to send push notification: ' . $exception->getMessage()); } } } }