public function receive(): ?array
    {
        if (!$this->isConnected()) {
            return null;
        }

        $data = $this->socket->receive();

        if (!$data) {
            return [];
        }

        $this->payloadHandler->handle($data);
        $received = $this->received;
        $this->received = [];
        return $received;
    }
public function receive(): ?array
    {
        if (!$this->isConnected()) {
            return null;
        }

        $data = $this->socket->receive();

        if (!$data) {
            return [];
        }

        $this->payloadHandler->handle($data);
        $received = $this->received;
        $this->received = [];
        return $received;
    }
public function receive ( ) : ? array { if ( ! $ this -> isConnected ( ) ) { return null ; } $ data = $ this -> socket -> receive ( ) ; if ( ! $ data ) { return [ ] ; } $ this -> payloadHandler -> handle ( $ data ) ; $ received = $ this -> received ; $ this -> received = [ ] ; return $ received ; }
Receives data sent by the server

@return array<Payload> Payload received since the last call to receive()
Receives data sent by the server