You are here

public function ListenerPageController::jsonResponse in Evercurrent 8.2

Same name and namespace in other branches
  1. 8 src/Controller/ListenerPageController.php \Drupal\evercurrent\Controller\ListenerPageController::jsonResponse()

Wrapper function for the json response.

Parameters

mixed $message: The message we are sending.

string $type: One of "error" or "status".

Return value

Symfony\Component\HttpFoundation\JsonResponse Message and Type wrapped in a json structure.

1 call to ListenerPageController::jsonResponse()
ListenerPageController::content in src/Controller/ListenerPageController.php
Renders the content for a dashboard that is listening.

File

src/Controller/ListenerPageController.php, line 67

Class

ListenerPageController
Creates a callback for listening to the server.

Namespace

Drupal\evercurrent\Controller

Code

public function jsonResponse($message, $type) {
  return new JsonResponse([
    'data' => [
      'message' => $message,
      'type' => $type,
    ],
  ]);
}