public function readBuffer()
    {
        $buffer = fread($this->socket, $this->read_buffer_size);
        
        if ($buffer === '' || $buffer === false) {
            if (feof($this->socket) || !is_resource($this->socket)) {
                
                $this->removeEventLooper();
                $this->status = static::STATUS_CLOSED;
                
                $event  = new CloseEvent([
                    'by' => CloseEvent::BY_PEER,
                ]);
                
                $this->trigger(Server::ON_CLOSE, $event);
                $this->destroy();
            }
            
            return false;
        } else {
            $this->recvBuffer .= $buffer;
        }
        
        if($this->_pipe && !$this->_pipe->isClosed()){
            return $this->_pipe->send($buffer, true);
        }
        
        while($this->recvBuffer){
            
            try{
                $len = $this->parser ?
                    call_user_func([$this->parser, 'input'], $this->recvBuffer, $this)
                    : strlen($this->recvBuffer);
                
                if($len === 0) {
                    return ;
                }
                
            }catch (\Exception $e){
                $this->recvBuffer = '';
                
                $event = new ErrorEvent([
                    'code' => $e->getCode(),
                    'errstr' => $e->getMessage()
                ]);
                
                $this->trigger(Server::ON_BAD_PACKET, $event);
                return ;
            }
            
            $message = substr($this->recvBuffer, 0, $len);
            $this->recvBuffer = substr($this->recvBuffer, $len);
            
            if($this->parser) {
                try{
                    $message = call_user_func([$this->parser, 'decode'], $message, $this);
                    
                }catch (\Exception $e){
                    $this->recvBuffer = '';
                    
                    $event = new ErrorEvent([
                        'code' => $e->getCode(),
                        'errstr' => $e->getMessage()
                    ]);
                    
                    $this->trigger(Server::ON_BAD_PACKET, $event);
                    return ;
                }
            }
            
            
            $this->response_at = microtime(true);
            $event = new MessageEvent($this);
            $event->message = $message;
            
            $this->trigger(Server::ON_MESSAGE, $event);
        }
    }