private function getCookie($name, $decrypt = false)
    {
        try {
            $cookies = $this->connection->WebSocket->request->getCookies();

            if (isset($cookies[$name])) {
                $raw = rawurldecode($cookies[$name]);

                if (!$decrypt) {
                    return $raw;
                }

                $decrypted = @Crypt::decrypt($raw);

                if ($decrypted) {
                    return $decrypted;
                }
            }

            return null;
        } catch (Exception $ex) {
            \Log::error($ex);

            return null;
        }
    }