/** * Sends a notification through socket.io * * @param Notification $notification * @param string $actionUrl * @return void */ private function sendNotification($notification, $actionUrl = null) { $data = array('id' => (string) $notification->getId(), 'title' => $notification->getTitle(), 'content' => $notification->getContent(), 'actionCaption' => $notification->getActionCaption(), 'actionUrl' => $actionUrl); $socketClient = $this->get('elephantio_client.ainotifier'); $socketClient->send('new', ['notification' => json_encode($data)]); }