MISC: Allow using wss for RFA (#1942)

This commit is contained in:
catloversg
2025-02-01 02:07:38 +07:00
committed by GitHub
parent 40c696feb1
commit 822c55574d
3 changed files with 12 additions and 3 deletions
+2 -2
View File
@@ -2,6 +2,7 @@ import { RFAMessage } from "./MessageDefinitions";
import { RFARequestHandler } from "./MessageHandlers";
import { SnackbarEvents } from "../ui/React/Snackbar";
import { ToastVariant } from "@enums";
import { Settings } from "../Settings/Settings";
function showErrorMessage(address: string, detail: string) {
SnackbarEvents.emit(`Error with websocket ${address}, details: ${detail}`, ToastVariant.ERROR, 5000);
@@ -9,7 +10,6 @@ function showErrorMessage(address: string, detail: string) {
export class Remote {
connection?: WebSocket;
static protocol = "ws";
ipaddr: string;
port: number;
@@ -23,7 +23,7 @@ export class Remote {
}
public startConnection(): void {
const address = Remote.protocol + "://" + this.ipaddr + ":" + this.port;
const address = (Settings.UseWssForRemoteFileApi ? "wss" : "ws") + "://" + this.ipaddr + ":" + this.port;
try {
this.connection = new WebSocket(address);
} catch (error) {