I need response some variables immediately and continue executing another process in Zend Framework 2, this code could help:
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->sendData("params");
$varsToView["resultJson"] = \Zend\Json\Json::encode($response);
$viewModel = new ViewModel($varsToView);
$viewModel->setTerminal(true);
return $viewModel;}
In the view (wstests.phtml) I have this code:
<?=$this->resultJson?>
Thanks!!!
It works perfect.