Example #1
0
 public function listen()
 {
     $this->initServer();
     while (true) {
         try {
             $message = $this->receiveMessage();
             $object = Request::fromString($message);
             echo time() . " - " . $object->getMethod() . " " . json_encode($object->getParams()) . "\n";
             $dispatcher = new RequestDispacher($object, $this->service);
             $response = $dispatcher->getResponse();
             $this->postMessage($response->__toString());
         } catch (\Exception $e) {
         }
     }
 }