Example #1
0
 protected function serverRequest($client, ServerRequest $request, $callback)
 {
     $response = $callback($request);
     if (!$response instanceof Response) {
         $response = new Response($response);
     }
     $keepAlive = $request->isKeepAlive();
     $response->withKeepAlive($keepAlive);
     $client->write($response->getOutput());
     if ($keepAlive) {
         $this->resetClient($client);
         return;
     }
     $client->shutdown();
 }