From 62379f7899645f2affa8eedbdbd0d2561412d1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20Monnom?= Date: Mon, 30 Oct 2023 18:54:06 -0700 Subject: [PATCH] api-v0.1.3 & correctly translate scheme inside the TwirpClient --- livekit-api/livekit/api/_twirp_client.py | 6 +++++- livekit-api/livekit/api/version.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/livekit-api/livekit/api/_twirp_client.py b/livekit-api/livekit/api/_twirp_client.py index 55deab8b..09f726ab 100644 --- a/livekit-api/livekit/api/_twirp_client.py +++ b/livekit-api/livekit/api/_twirp_client.py @@ -54,7 +54,11 @@ class TwirpErrorCode: class TwirpClient: def __init__(self, host: str, pkg: str, prefix: str = DEFAULT_PREFIX) -> None: parse_res = urlparse(host) - host = f"http://{parse_res.netloc}/{parse_res.path}" + scheme = parse_res.scheme + if scheme.startswith("ws"): + scheme = scheme.replace("ws", "http") + + host = f"{scheme}://{parse_res.netloc}/{parse_res.path}" self.host = host.rstrip("/") self.pkg = pkg self.prefix = prefix diff --git a/livekit-api/livekit/api/version.py b/livekit-api/livekit/api/version.py index b3f47562..ae736254 100644 --- a/livekit-api/livekit/api/version.py +++ b/livekit-api/livekit/api/version.py @@ -1 +1 @@ -__version__ = "0.1.2" +__version__ = "0.1.3"