Changeset View
Changeset View
Standalone View
Standalone View
web/app/src/urls.js
| let url = new URL(window.location.href); | let url = new URL(window.location.href); | ||||
| // Uncomment this when the web interface is running on a different port than the | |||||
| // API, for example when using the Vite devserver. Set the API port here. | |||||
| if (url.port == "8081") { | |||||
| url.port = "8080"; | |||||
| } | |||||
| url.pathname = "/"; | |||||
| const flamencoAPIURL = url.href; | |||||
| url.protocol = "ws:"; | url.pathname = "/"; | ||||
| const websocketURL = url.href; | |||||
| const URLs = { | const HREF = url.href; | ||||
| api: flamencoAPIURL, | |||||
| ws: websocketURL, | |||||
| }; | |||||
| // console.log("Flamenco API:", URLs.api); | // console.log("Flamenco API:", URLs.api); | ||||
| // console.log("Websocket :", URLs.ws); | // console.log("Websocket :", URLs.ws); | ||||
| export function ws() { | export const ws = () => HREF; | ||||
| return URLs.ws; | export const api = () => HREF; | ||||
sybren: This changes the `ws:` (from the original code) to `http:` or `https:` (in the new code). Does… | |||||
Done Inline ActionsAcording to the socket.io it doesn't matter jan_thoma: Acording to the socket.io it doesn't matter
https://socket.io/docs/v3/client-initialization/ | |||||
Done Inline Actionsjan_thoma: The manager shows me a working websocket, after building it
{F13491194} | |||||
| } | |||||
| export function api() { | |||||
| return URLs.api; | |||||
| } | |||||
| // Backend URLs (like task logs, SwaggerUI, etc.) should be relative to the API | // Backend URLs (like task logs, SwaggerUI, etc.) should be relative to the API | ||||
| // url in order to stay working when the web development server is in use. | // url in order to stay working when the web development server is in use. | ||||
| export function backendURL(path) { | export const backendURL = (path) => new URL(path, HREF).href; | ||||
| const url = new URL(path, URLs.api); | |||||
| return url.href; | |||||
| } | |||||

This changes the ws: (from the original code) to http: or https: (in the new code). Does this still work when you run things without the Vite dev server?