/** * Redirect message to app and returns value as json response. * * @param string $appName * @param Request $request * * @return JsonResponse */ public function send($appName, Request $request) { $sessionName = ini_get('session.name'); $message = $request->get('message'); $id = $request->cookies->get($sessionName); $app = $this->appManager->getApp($appName); $connection = new FallbackConnection($id); $app->onMessage($connection, $message); // clean output buffer if there is data in it // happens if a twig error occurs if (ob_get_length() > 0) { ob_clean(); } return new Response($connection->getData(), 200, ['Content-Type' => 'application/json']); }
/** * {@inheritdoc} */ public function getParameters() { return $this->appManager->getApps(); }