feat(ui) working on making socket URL dynamic

This commit is contained in:
Mary Hipp
2023-04-05 14:31:54 -04:00
committed by psychedelicious
parent b31b8d31ad
commit 793a4ddbb2

View File

@@ -27,8 +27,15 @@ import {
invokeSession,
isFulfilledCreateSession,
} from 'services/thunks/session';
import { OpenAPI } from 'services/api';
const socket_url = `ws://${window.location.host}`;
let socket_url = `ws://${window.location.host}`;
// if building in package mode, replace socket url with open api base url minus the http protocol
if (import.meta.env.MODE === 'package' && OpenAPI.BASE) {
//eslint-disable-next-line
socket_url = OpenAPI.BASE.replace(/^https?\:\/\//i, '');
}
const socket = io(socket_url, {
timeout: 60000,