public function setProtocol($protocol)
    {
        $lowerProtocol = strtolower($protocol);

        // handle special cases where protocol is not
        // formatted as intended yet.

        if ("websocket" == $lowerProtocol)
            $lowerProtocol = "ws";

        if (in_array($lowerProtocol, ["https", "wss"])) {
            // provided secure type of protocol
            $this->setUseSsl(true);
            $lowerProtocol = substr($lowerProtocol, 0, -1);
        }

        $this->protocol = $lowerProtocol;
        return $this;
    }