Disque\Connection\Socket::getType PHP Method

getType() private method

Get the first byte from Disque, which contains the data type
private getType ( boolean $keepWaiting = false ) : string
$keepWaiting boolean If `true`, timeouts on stream read will be ignored
return string A single char
    private function getType($keepWaiting = false)
    {
        $type = null;
        while (!feof($this->socket)) {
            $type = fgetc($this->socket);
            if ($type !== false && $type !== '') {
                break;
            }
            $info = stream_get_meta_data($this->socket);
            if (!$keepWaiting || !$info['timed_out']) {
                break;
            }
        }
        if ($type === false || $type === '') {
            throw new ConnectionException('Nothing received while reading from client');
        }
        return $type;
    }