We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ca88974 + aeb5911 commit 234fef5Copy full SHA for 234fef5
src/textual_serve/server.py
@@ -93,6 +93,8 @@ def __init__(
93
if public_url is None:
94
if self.port == 80:
95
self.public_url = f"http://{self.host}"
96
+ elif self.port == 443:
97
+ self.public_url = f"https://{self.host}"
98
else:
99
self.public_url = f"http://{self.host}:{self.port}"
100
@@ -251,7 +253,11 @@ def get_url(route: str, **args) -> str:
251
253
def get_websocket_url(route: str, **args) -> str:
252
254
"""Get a URL with a websocket prefix."""
255
url = get_url(route, **args)
- return "ws:" + url.split(":", 1)[1]
256
+
257
+ if self.public_url.startswith("https"):
258
+ return "wss:" + url.split(":", 1)[1]
259
+ else:
260
+ return "ws:" + url.split(":", 1)[1]
261
262
context = {
263
"font_size": font_size,
0 commit comments