Called when new data received
@return void
517909
protected function onRead()
    {
        start:
        if ($this->state === self::STATE_ROOT) {
            while (($l = $this->readLine()) !== null) {
                $e = explode(' ', $l);

                if ($e[0] === 'VALUE') {
                    $this->key = $e[1];
                    $this->valueFlags = $e[2];
                    $this->valueLength = $e[3];
                    $this->result = '';
                    $this->setWatermark($this->valueLength);
                    $this->state = self::STATE_DATA;
                    break;
                } elseif ($e[0] === 'STAT') {
                    if ($this->result === null) {
                        $this->result = [];
                    }

                    $this->result[$e[1]] = $e[2];
                } elseif (($e[0] === 'STORED') || ($e[0] === 'END') || ($e[0] === 'DELETED') || ($e[0] === 'ERROR')
                    || ($e[0] === 'CLIENT_ERROR') || ($e[0] === 'SERVER_ERROR')
                ) {
                    if ($e[0] !== 'END') {
                        $this->result = false;
                        $this->error = isset($e[1]) ? $e[1] : null;
                    }
                    $this->onResponse->executeOne($this);
                    $this->checkFree();
                    $this->result = null;
                }
            }
        }

        if ($this->state === self::STATE_DATA) {
            if (false === ($this->result = $this->readExact($this->valueLength))) {
                return; //we do not have a whole packet
            }
            $this->state = self::STATE_ROOT;
            $this->setWatermark(1);
            goto start;
        }
    }
700334
def data_received(self, data):
        """"""
        self.tokenizer.feed(data)
        while self.tokenizer.has_tokens():
            raw = self.tokenizer.get_next_token()
            frame = frame_from_raw(raw)
            if frame is not None:
                self.frame_received_cb(frame)
231218
protected function onInputEnd()
    {
        if ($this->sort) {
            ksort($this->gData, SORT_STRING);
        }
        foreach ($this->gData as $index => $data) {
            $this->next($data);
        }
    }
615632
protected function broadcast()
    {
        if (function_exists('broadcast')) {
            broadcast(new NotificationPushed($this->push));
        } elseif (function_exists('event')) {
            event(new NotificationPushed($this->push));
        }
    }
818710
public function done()
	{
		// Compute the totall length of the output
		$length = $this->contentLength + $this->initMessageLength;

		// Back up all the way
		$this->backspace($length, true);

		// In case this gets used again...
		$this->contentLength     = 0;
		$this->initMessageLength = 0;
	}
713964
public function onReady()
    {
        $this->connected = true;
        if ($this->onConnected) {
            $this->onConnected->executeAll($this);
            $this->onConnected = null;
        }
    }
101213
public function touch()
    {
        $model = $this->getRelated();

        if (! $model::isIgnoringTouch()) {
            $this->rawUpdate([
                $model->getUpdatedAtColumn() => $model->freshTimestampString(),
            ]);
        }
    }
1001174
protected function onRead()
    {
        if (!$this->policyReqNotFound) {
            $d = $this->drainIfMatch("<policy-file-request/>\x00");
            if ($d === null) { // partially match
                return;
            }
            if ($d) {
                if (($FP = \PHPDaemon\Servers\FlashPolicy\Pool::getInstance($this->pool->config->fpsname->value,
                        false)) && $FP->policyData
                ) {
                    $this->write($FP->policyData . "\x00");
                }
                $this->finish();
                return;
            } else {
                $this->policyReqNotFound = true;
            }
        }
        start:
        if ($this->finished) {
            return;
        }
        if ($this->state === self::STATE_STANDBY) {
            $this->state = self::STATE_FIRSTLINE;
        }
        if ($this->state === self::STATE_FIRSTLINE) {
            if (!$this->httpReadFirstline()) {
                return;
            }
            $this->state = self::STATE_HEADERS;
        }

        if ($this->state === self::STATE_HEADERS) {
            if (!$this->httpReadHeaders()) {
                return;
            }
            if (!$this->httpProcessHeaders()) {
                $this->finish();
                return;
            }
            $this->state = self::STATE_CONTENT;
        }
        if ($this->state === self::STATE_CONTENT) {
            $this->state = self::STATE_PREHANDSHAKE;
        }
    }
1049772
public function onRead()
    {
        start:
        if ($this->state === static::STATE_HEADER) {
            $l = $this->getInputLength();
            if ($l < 2) {
                return;
            }
            $hdr = $this->look(2);
            $fb = Binary::getbitmap(ord($hdr));
            $fin = (bool)$fb{0};
            $opCode = bindec(substr($fb, 4, 4));

            if (isset($this->opCodes[$opCode])) {
                $this->type = $this->opCodes[$opCode];
            } else {
                $this->log('opCode: ' . $opCode . ': unknown frame type');
                $this->finish();
                return;
            }
            $sb = ord(mb_orig_substr($hdr, 1));
            $sbm = Binary::getbitmap($sb);
            $this->isMasked = (bool)$sbm{0};
            $payloadLength = $sb & 127;

            if ($payloadLength <= 125) {
                $this->drain(2);
                $this->pctLength = $payloadLength;
            } elseif ($payloadLength === 126) {
                if ($l < 4) {
                    return;
                }
                $this->drain(2);
                $this->pctLength = Binary::b2i($this->read(2));
            } elseif ($payloadLength === 127) {
                if ($l < 10) {
                    return;
                }
                $this->drain(2);
                $this->pctLength = Binary::b2i($this->read(8));
            }

            if ($this->pool->maxAllowedPacket < $this->pctLength) {
                Daemon::$process->log('max-allowed-packet (' . $this->pool->config->maxallowedpacket->getHumanValue() . ') exceed, aborting connection');
                $this->finish();
                return;
            }
            $this->setWatermark($this->pctLength + ($this->isMasked ? 4 : 0));
            $this->state = static::STATE_DATA;
        }

        if ($this->state === static::STATE_DATA) {
            if ($this->getInputLength() < $this->pctLength + ($this->isMasked ? 4 : 0)) {
                return;
            }
            $this->state = static::STATE_HEADER;
            $this->setWatermark(2);
            if ($this->isMasked) {
                $this->trigger('frame', static::mask($this->read(4), $this->read($this->pctLength)));
            } else {
                $this->trigger('frame', $this->read($this->pctLength));
            }
        }
        if ($this->state === static::STATE_STANDBY) {
            while (($line = $this->readLine()) !== null) {
                $line = trim($line);
                if ($line === '') {
                    $expectedKey = base64_encode(pack('H*', sha1($this->key . static::GUID)));
                    if (isset($this->headers['HTTP_SEC_WEBSOCKET_ACCEPT']) && $expectedKey === $this->headers['HTTP_SEC_WEBSOCKET_ACCEPT']) {
                        $this->state = static::STATE_HEADER;
                        if ($this->onConnected) {
                            $this->connected = true;
                            $this->onConnected->executeAll($this);
                            $this->onConnected = null;
                        }
                        $this->trigger('connected');
                        goto start;
                    } else {
                        Daemon::$process->log(__METHOD__ . ': Handshake failed. Connection to ' . $this->url . ' failed.');
                        $this->finish();
                    }
                } else {
                    $e = explode(': ', $line);
                    if (isset($e[1])) {
                        $this->headers['HTTP_' . strtoupper(strtr($e[0], ['-' => '_']))] = $e[1];
                    }
                }
            }
            return;
        }
        goto start;
    }
1092599
public function sendNextMessage()
    {
        if (count($this->outQueue) > 0) {
            $msgnode = array_shift($this->outQueue);
            $msgnode->refreshTimes();
            $this->lastId = $msgnode->getAttribute('id');
            $this->sendNode($msgnode);
        } else {
            $this->lastId = false;
        }
    }
950988
public function onReady()
    {
        $conn = $this;
        $this->keepaliveTimer = setTimeout(function ($timer) use ($conn) {
            $conn->ping();
        }, 10e6);
    }
558167
public function onReady()
    {
        if (static::$requestCommandListFlipped === null) {
            static::$requestCommandListFlipped = array_flip(static::$requestCommandList);
        }
        if (static::$responseCommandListFlipped === null) {
            static::$responseCommandListFlipped = array_flip(static::$responseCommandList);
        }
        parent::onReady();
    }
645842
protected function onInput($data)
    {
        $this->index++;
        if ($this->index >= $this->offset && $this->index < $this->offset + $this->limit) {
            $this->next($data);
        }
    }
83028
final protected function _loadData()
    {
        if (!$this->isLoaded()) {
            $this->_object_set = new ArrayObject();
            foreach ($this->_getData() as $object) {
                $this->insert($object);
            }
        }
    }
1063788
protected function onInputEnd()
    {
        //Send meta
        $countRow = count($this->data);
        $newMeta = array(
            "columns" => array(),
        );
        for ($i = 0; $i <= $countRow; $i++) {
            $newMeta["columns"]["c$i"] = array("type" => "unknown");
        }
        $newMeta["columns"]["c0"]["type"] = "string";
        $this->sendMeta($newMeta);

        $keys = ($countRow > 0) 
            ? array_keys($this->data[0]) : array_keys($this->metaData["columns"]);

        //Send each rows
        foreach ($keys as $cKey) {
            $row = array("c0" => isset($this->metaData["columns"][$cKey]["label"]) 
                ? $this->metaData["columns"][$cKey]["label"] : $cKey);
            for ($i = 0; $i < $countRow; $i++) {
                $row["c" . ($i + 1)] = $this->data[$i][$cKey];
                unset($this->data[$i][$cKey]);
            }
            $this->next($row);
        }
    }
559011
def data_received(self, data):
        """"""
        data = data.decode()
        log.debug('received data: %s', data.strip())
        self.buffer += data
        self.handle_lines()
907204
public function newAction(): void
    {
        try {
            $maximumFileUploadSize = $this->getMaximumFileUploadSize();
        } catch (FilesException $e) {
            $maximumFileUploadSize = null;
        }

        $this->view->assignMultiple([
            'tags' => $this->tagRepository->findAll(),
            'assetCollections' => $this->assetCollectionRepository->findAll(),
            'maximumFileUploadSize' => $maximumFileUploadSize,
            'humanReadableMaximumFileUploadSize' => Files::bytesToSizeString($maximumFileUploadSize)
        ]);
    }