src/VK/CallbackApi/LongPoll/VKCallbackApiLongPollExecutor.php
public function listen(?int $ts = null) {
        if ($this->server === null) {
            $this->server = $this->getLongPollServer();
        }

        if ($this->last_ts === null) {
            $this->last_ts = $this->server[static::SERVER_TIMESTAMP];
        }

        if ($ts === null) {
            $ts = $this->last_ts;
        }

        try {
            $response = $this->getEvents($this->server[static::SERVER_URL], $this->server[static::SERVER_KEY], $ts);
            foreach ($response[static::EVENTS_UPDATES] as $event) {
                $this->handler->parseObject($this->group_id, null, $event[static::EVENT_TYPE], $event[static::EVENT_OBJECT]);
            }

            $this->last_ts = $response[static::EVENTS_TS];
        } catch (VKLongPollServerKeyExpiredException $e) {
            $this->server = $this->getLongPollServer();
        }

        return $this->last_ts;
    }
public function listen(?int $ts = null) {
        if ($this->server === null) {
            $this->server = $this->getLongPollServer();
        }

        if ($this->last_ts === null) {
            $this->last_ts = $this->server[static::SERVER_TIMESTAMP];
        }

        if ($ts === null) {
            $ts = $this->last_ts;
        }

        try {
            $response = $this->getEvents($this->server[static::SERVER_URL], $this->server[static::SERVER_KEY], $ts);
            foreach ($response[static::EVENTS_UPDATES] as $event) {
                $this->handler->parseObject($this->group_id, null, $event[static::EVENT_TYPE], $event[static::EVENT_OBJECT]);
            }

            $this->last_ts = $response[static::EVENTS_TS];
        } catch (VKLongPollServerKeyExpiredException $e) {
            $this->server = $this->getLongPollServer();
        }

        return $this->last_ts;
    }
public function listen ( ? int $ ts = null ) { if ( $ this -> server === null ) { $ this -> server = $ this -> getLongPollServer ( ) ; } if ( $ this -> last_ts === null ) { $ this -> last_ts = $ this -> server [ static :: SERVER_TIMESTAMP ] ; } if ( $ ts === null ) { $ ts = $ this -> last_ts ; } try { $ response = $ this -> getEvents ( $ this -> server [ static :: SERVER_URL ] , $ this -> server [ static :: SERVER_KEY ] , $ ts ) ; foreach ( $ response [ static :: EVENTS_UPDATES ] as $ event ) { $ this -> handler -> parseObject ( $ this -> group_id , null , $ event [ static :: EVENT_TYPE ] , $ event [ static :: EVENT_OBJECT ] ) ; } $ this -> last_ts = $ response [ static :: EVENTS_TS ] ; } catch ( VKLongPollServerKeyExpiredException $ e ) { $ this -> server = $ this -> getLongPollServer ( ) ; } return $ this -> last_ts ; }
Starts listening to LongPoll events.

@param int|null $ts

@return null
@throws VKLongPollServerTsException
@throws VKApiException
@throws VKClientException
Starts listening to LongPoll events .