Wait for the server to respond with data and a status.

@return array [response data, status]
432171
public function wait()
    {
        $event = $this->call->startBatch([
            OP_SEND_CLOSE_FROM_CLIENT => true,
            OP_RECV_INITIAL_METADATA => true,
            OP_RECV_MESSAGE => true,
            OP_RECV_STATUS_ON_CLIENT => true,
        ]);
        $this->metadata = $event->metadata;

        $status = $event->status;
        $this->trailing_metadata = $status->metadata;

        return [$this->_deserializeResponse($event->message), $status];
    }
1095702
public function onReady()
    {
        $this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance();

        /*$this->redis->eval("return {'a','b','c', {'d','e','f', {'g','h','i'}} }",0, function($redis) {
            Daemon::log(Debug::dump($redis->result));
        });*/

        $this->redis->subscribe('te3st', function ($redis) {
            Daemon::log(Debug::dump($redis->result));
        });
        $this->redis->psubscribe('test*', function ($redis) {
            Daemon::log(Debug::dump($redis->result));

        });
    }
71643
public function processResponse()
    {
        if (empty($this->packets_response)) {
            return [];
        }
        
        // Implode and rip out the JSON
        preg_match('/\{(.*)\}/ms', implode('', $this->packets_response), $matches);

        // Return should be JSON, let's validate
        if (!isset($matches[0]) || ($json = json_decode($matches[0])) === null) {
            throw new Exception("JSON response from Tshock protocol is invalid.");
        }

        // Check the status response
        if ($json->status != 200) {
            throw new Exception("JSON status from Tshock protocol response was '{$json->status}', expected '200'.");
        }

        $result = new Result();

        // Server is always dedicated
        $result->add('dedicated', 1);

        // Add server items
        $result->add('hostname', $json->name);
        $result->add('game_port', $json->port);
        $result->add('serverversion', $json->serverversion);
        $result->add('world', $json->world);
        $result->add('uptime', $json->uptime);
        $result->add('password', (int)$json->serverpassword);
        $result->add('numplayers', $json->playercount);
        $result->add('maxplayers', $json->maxplayers);

        // Parse players
        foreach ($json->players as $player) {
            $result->addPlayer('nickname', $player->nickname);
            $result->addPlayer('username', $player->username);
            $result->addPlayer('group', $player->group);
            $result->addPlayer('active', (int)$player->active);
            $result->addPlayer('state', $player->state);
            $result->addPlayer('team', $player->team);
        }

        // Make rules into simple array
        $rules = [];

        // Parse rules
        foreach ($json->rules as $rule => $value) {
            // Add rule but convert boolean into int (0|1)
            $rules[$rule] = (is_bool($value)) ? (int)$value : $value;
        }

        // Add rules
        $result->add('rules', $rules);

        unset($rules, $rule, $player, $value);

        return $result->fetch();
    }
1304215
protected function response($return, $url = '', $wait = 3, $header = [])
    {
        if ($return->isSuccess()) {
            $this->success($return->getMsg(), $url, $return->getData(), $wait, $header);
        } else {
            $this->error($return->getMsg(), $url, $return->getData(), $wait, $header);
        }
    }
270451
private function fetchResponse()
    {
        $type = $this->settings['type'];

        if (strpos('|INSERT|UPDATE|DELETE|REPLACE|', $type)) {
            if ($this->settings['result'] === 'id') {
                return $this->lastInsertId;
            }

            return $this->rowCount;
        } elseif ($type === 'SELECT') {
            if ($this->settings['result'] !== 'rows') {
                return $this->provider->fetchResponse(
                    $this->response,
                    $this->settings['result']
                );
            }
            if (is_object($this->response)) {
                return $this->provider->rowCount($this->response);
            }
        }

        return true;
    }
571513
protected function fetchData()
    {
        $uri = $this->getUri();
        if (!$uri) {
            return;
        }

        $client = new \Zend\Http\Client($this->getUri());
        $client->setMethod('GET');

        try {
            $response = $client->send();
        } catch (\Exception $e) {
            return;
        }

        $status = $response->getStatusCode();
        if ($status == 200) {
            $result = $response->getBody();
            $result = (array) json_decode($result);
            if (0 < count($result)) {
                $name = array_pop($result);
                $this->setName($name);
            }
        }
    }
360301
public function onReady()
    {
        if ($this->url === null) {
            return;
        }

        if ($this->connected && !$this->busy) {
            $this->pool->servConnFree[$this->url]->attach($this);
        }

        $url = parse_url($this->url);

        $this->username = $url['user'];
        $this->secret = $url['pass'];
    }
577544
async def wait(self):
        
        if self._ping_task is None:
            raise RuntimeError('Response is not started')
        with contextlib.suppress(asyncio.CancelledError):
            await self._ping_task
85526
public function wait(): Process
    {
        $cursor = $this->events->getCursor([
            'job' => $this->getId(),
            'status' => ['$gte' => JobInterface::STATUS_DONE],
        ]);

        while (true) {
            if (null === $cursor->current()) {
                if ($cursor->getInnerIterator()->isDead()) {
                    $this->events->create();

                    return $this->wait();
                }

                $this->events->next($cursor, function () {
                    $this->wait();
                });

                continue;
            }

            $event = $cursor->current();
            $this->events->next($cursor, function () {
                $this->wait();
            });

            $this->job['status'] = $event['status'];

            if (JobInterface::STATUS_FAILED === $this->job['status'] && isset($event['exception'])) {
                throw new $event['exception']['class'](
                    $event['exception']['message'],
                    $event['exception']['code']
                );
            }

            return $this;
        }
    }
759758
def request_status(self):
        ''''''
        self.sendcommand(Vendapin.REQUEST_STATUS)
        # wait for the reply
        time.sleep(1)
        response = self.receivepacket()
        if self.was_packet_accepted(response):
            return Vendapin.READY
        else:
            return self.parsedata(response)[0]
131286
public function wait() {
        if ($this->pid) {
            \pcntl_waitpid($this->pid, $status, WUNTRACED);
            return $status;
        } else {
            return false;
        }
    }
530550
private function initial_response()
    {
        $options = $this->options;
        $options['params']['after'] = null;
        return $this->service->list($options);
    }
911900
public function response()
    {
        $this->response = $this->client->send($this->request);

        return $this->response->json();
    }
331446
public function status()
    {
        return array_key_exists($this->statusCode(), self::$statuses)
            ? self::$statuses[$this->statusCode()]
            : 'Unknown';
    }
412555
public function wait()
    {
        curl_multi_exec($this->mh, $active); // Start requests.
        do {
            // if cURL handle is running, use curl_multi_select()
            // otherwise, just sleep until nearest time
            $this->scheduler->isEmpty()
                ? $this->delayer->sleep()
                : curl_multi_select($this->mh, $this->options['interval']) < 0
                  && usleep($this->options['interval'] * 1000000);
            curl_multi_exec($this->mh, $active);
            $this->scheduler->consume();
            $this->delayer->consume();
        } while (!$this->haltException && (!$this->scheduler->isEmpty() || !$this->delayer->isEmpty()));
        if ($this->haltException) {
            throw $this->haltException;
        }
    }
77692
public function getStatus()
	{
		$response = $this->parent->send(new Request($this->uri->withPath($this->uri->getPath().'operations/'
			.$this->getIdentifier()), 'GET'));

		if ($response->getStatusCode() == 200)
		{
			$response = json_decode($response->getBody(), true);

			if (isset($response['status']))
			{
				return $response['status'];
			}
		}

		return null;
	}
1063132
public function wait()
  {
    if($this->getTransport()->getConfig("blocking"))
    {
      throw new AdapterException("only available in non-blocking mode");
    }

    do {
      $evt = $this->getTransport()->readLine();
    } while($evt instanceof Str && !$evt->section(TeamSpeak3::SEPARATOR_CELL)->startsWith(TeamSpeak3::EVENT));

    return new Event($evt, $this->getHost());
  }