Skip to content

Commit 723c899

Browse files
committed
Fix ws url generation
1 parent 5b41b24 commit 723c899

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/frontend/src/state/epics/wsEpics.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ import {
2626

2727
let socket$: WebSocketSubject<PayloadAction> | null = null
2828

29+
const isElectron = window.location.protocol === "file:"
30+
const isHttps = window.location.protocol === "https:"
31+
2932
const url =
30-
process.env.VALKEY_ADMIN_WS_URL || `ws://${window.location.hostname || "localhost"}:${window.location.port || "8080"}`
33+
process.env.VALKEY_ADMIN_WS_URL ||
34+
(isElectron
35+
? "ws://localhost:8080"
36+
: `${isHttps ? "wss" : "ws"}://${window.location.host}`)
3137

3238
const connect = (store: Store) =>
3339
action$.pipe(

0 commit comments

Comments
 (0)