From: Lucas Di Pentima Date: Tue, 20 Aug 2019 13:27:35 +0000 (-0300) Subject: 15407: Fixes app crash when webSocketUrl is not set on the API Server. X-Git-Tag: 2.0.0~40^2~3 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/e5b6b618ea041395c10568d7245d7733b4cb2a1e 15407: Fixes app crash when webSocketUrl is not set on the API Server. Instead, show a warning message on the JS console. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- diff --git a/src/websocket/websocket.ts b/src/websocket/websocket.ts index e3f1e192..4fd7cc2c 100644 --- a/src/websocket/websocket.ts +++ b/src/websocket/websocket.ts @@ -15,9 +15,13 @@ import { addProcessLogsPanelItem } from '../store/process-logs-panel/process-log import { FilterBuilder } from "~/services/api/filter-builder"; export const initWebSocket = (config: Config, authService: AuthService, store: RootStore) => { - const webSocketService = new WebSocketService(config.websocketUrl, authService); - webSocketService.setMessageListener(messageListener(store)); - webSocketService.connect(); + if (config.websocketUrl) { + const webSocketService = new WebSocketService(config.websocketUrl, authService); + webSocketService.setMessageListener(messageListener(store)); + webSocketService.connect(); + } else { + console.warn("WARNING: webSocketUrl is not configured on the API Server"); + } }; const messageListener = (store: RootStore) => (message: ResourceEventMessage) => {