title: ZF2 response view and continue processing another code after this http response
body: <p>I need response some variables immediately and continue executing another process in Zend Framework 2, this code could help:</p>
  
  <pre><code>public function wstestsAction(){
  
  //This variables needs to be responded immediately
  $response["response"] = true;
  $response["message"] = "Msg Test";
  
  //This process could take 1 minute
  $libraryInstance = new libraryInstance();
  $sendData = $libraryInstance-&gt;sendData("params");
  
  $varsToView["resultJson"] = \Zend\Json\Json::encode($response);
  $viewModel = new ViewModel($varsToView);
  $viewModel-&gt;setTerminal(true);
  return $viewModel;}
  </code></pre>
  
  <p>In the view (wstests.phtml) I have this code:</p>
  
  <pre><code>&lt;?=$this-&gt;resultJson?&gt;
  </code></pre>
  
  <p>Thanks!!!</p>