public function pollMessage()
    {
        if (!$this->isConnected()) {
            throw new ConnectionException('Connection Closed!');
        }

        $r = [$this->socket];
        $w = [];
        $e = [];
        $s = socket_select($r, $w, $e, Constants::TIMEOUT_SEC, Constants::TIMEOUT_USEC);

        if ($s) {

            // Something to read
            if ($stanza = $this->readStanza()) {
                $this->processInboundData($stanza);

                return true;
            }
        }
        if (time() - $this->timeout > 60) {
            if ($this->pingCounter >= 3)
            {
              $this->sendOfflineStatus();
              $this->disconnect();
              $this->iqCounter = 1;
              $this->connect();
              $this->loginWithPassword($this->password);
              $this->pingCounter = 1;
            }
            else {
              $this->sendPing();
              $this->pingCounter++;
            }
        }

        return false;
    }