13 lines
355 B
TypeScript
13 lines
355 B
TypeScript
|
// const WS_BASE = 'ws://localhost:3000/ws/';
|
||
|
|
||
|
export function wsUrl(id: string) {
|
||
|
if (import.meta.env.WS_BASE) {
|
||
|
return import.meta.env.WS_BASE + id;
|
||
|
} else {
|
||
|
const loc = window.location;
|
||
|
let newUri = loc.protocol === "https:" ? "wss://" : "ws://";
|
||
|
newUri += loc.host + '/ws/' + id;
|
||
|
return newUri;
|
||
|
}
|
||
|
}
|