/** * @param array $hash * @return int */ public function write(array $hash) { $frame = $this->encoder->toCompressedFrame($hash, $this->nextSequence()); if ($this->unackedSequenceSize() >= $this->windowSize) { $this->ack(); } return $this->socket->write($frame); }