aboutsummaryrefslogtreecommitdiff
path: root/priv/static/lustre-server-component.mjs
diff options
context:
space:
mode:
authorHayleigh Thompson <me@hayleigh.dev>2024-06-12 17:03:42 +0100
committerHayleigh Thompson <me@hayleigh.dev>2024-06-12 17:03:42 +0100
commit896662b2adceca8cc2ef3113cadb83a61c94ba13 (patch)
treea6b783a201e5b7666a5aee22c393585169743c34 /priv/static/lustre-server-component.mjs
parent44d0df313ff48315161a67006a60265139eecab8 (diff)
downloadlustre-896662b2adceca8cc2ef3113cadb83a61c94ba13.tar.gz
lustre-896662b2adceca8cc2ef3113cadb83a61c94ba13.zip
:rocket: Build server component runtime.
Diffstat (limited to 'priv/static/lustre-server-component.mjs')
-rw-r--r--priv/static/lustre-server-component.mjs5
1 files changed, 4 insertions, 1 deletions
diff --git a/priv/static/lustre-server-component.mjs b/priv/static/lustre-server-component.mjs
index 2f2e868..8913469 100644
--- a/priv/static/lustre-server-component.mjs
+++ b/priv/static/lustre-server-component.mjs
@@ -388,8 +388,11 @@ var LustreServerComponent = class extends HTMLElement {
} else if (prev !== next) {
const id = this.getAttribute("id");
const route = next + (id ? `?id=${id}` : "");
+ const protocol = window.location.protocol === "https:" ? "wss" : "ws";
this.#socket?.close();
- this.#socket = new WebSocket(`ws://${window.location.host}${route}`);
+ this.#socket = new WebSocket(
+ `${protocol}://${window.location.host}${route}`
+ );
this.#socket.addEventListener(
"message",
(message) => this.messageReceivedCallback(message)