From b5f2296adeb2580f9f70bf64dbb225c2800f47ad Mon Sep 17 00:00:00 2001 From: Atridad Lahiji Date: Mon, 16 Jun 2025 11:13:35 -0600 Subject: [PATCH] Nice --- package.json | 1 + public/index.html | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a80dce3..7a89855 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ }, "scripts": { "start": "node server.js", + "start:prod": "NODE_ENV=production node server.js", "dev": "node server.js", "docker:build": "docker build -t encrypted-todo .", "docker:run": "docker run -p 3000:3000 encrypted-todo", diff --git a/public/index.html b/public/index.html index 026a79f..dbe966a 100644 --- a/public/index.html +++ b/public/index.html @@ -75,8 +75,10 @@ function connectWebSocket() { if (!currentUser) return; + const protocol = + window.location.protocol === "https:" ? "wss:" : "ws:"; ws = new WebSocket( - `ws://${window.location.host}?userId=${currentUser}`, + `${protocol}//${window.location.host}?userId=${currentUser}`, ); ws.onmessage = (event) => { const msg = JSON.parse(event.data);