public function setKeepAlivePeriod(int $keepAlivePeriod): self
    {
        if ($keepAlivePeriod > 65535 || $keepAlivePeriod < 0) {
            $this->logger->error('Keep alive period must be between 0 and 65535');
            throw new \InvalidArgumentException('Keep alive period must be between 0 and 65535');
        }

        $this->keepAlivePeriod = $keepAlivePeriod;
        return $this;
    }