Esempio n. 1
0
 /**
  * @override
  * @inheritDoc
  */
 public function handleMessage(NetworkConnectionInterface $conn, NetworkMessageInterface $message)
 {
     if ($conn->httpHeadersReceived !== true) {
         try {
             if (($request = $this->httpDriver->readRequest($conn->httpBuffer, $message->read())) === null) {
                 return;
             }
         } catch (Error $ex) {
             return $this->close($conn, 413);
         } catch (Exception $ex) {
             return $this->close($conn, 413);
         }
         $conn->httpHeadersReceived = true;
         $conn->httpRequest = $request;
         $this->httpServer->handleConnect($conn);
         $this->httpServer->handleMessage($conn, $request);
     } else {
         $this->httpServer->handleMessage($conn, $message);
     }
 }
Esempio n. 2
0
 /**
  * @param NetworkConnectionInterface $conn
  * @param string $message
  */
 public function wsMessage(NetworkConnectionInterface $conn, NetworkMessageInterface $message)
 {
     $this->onMessage($conn, $message->read());
 }