From 4c0bfbb4c2aa4094b6f178cb76676450b4993835 Mon Sep 17 00:00:00 2001 From: OlliL Date: Tue, 24 Dec 2024 01:56:26 +0100 Subject: [PATCH] support wss:// --- src/config/WebSocketSingleton.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/config/WebSocketSingleton.ts b/src/config/WebSocketSingleton.ts index f360fd0..37671b0 100644 --- a/src/config/WebSocketSingleton.ts +++ b/src/config/WebSocketSingleton.ts @@ -1,7 +1,7 @@ import { StoreService } from "@/stores/StoreService"; import { Client, type StompSubscription } from "@stomp/stompjs"; import { HeaderUtil } from "../service/util/HeaderUtil"; -import { webServerHost } from "./WebServerConfiguration"; +import { webServerHost, webServerProtocol } from "./WebServerConfiguration"; export class WebSocketSingleton { private static instance: WebSocketSingleton; @@ -17,7 +17,8 @@ export class WebSocketSingleton { } public async connectStompClient() { - const url = "ws://" + webServerHost + "/websocket"; + const webSocketProtocol = webServerProtocol.replace("http", "ws"); + const url = webSocketProtocol + "//" + webServerHost + "/websocket"; this.stompClient = new Client({ brokerURL: url,