From 90801ff31b5c8218e735b748840262480c254c8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Mon, 26 Jul 2021 16:54:48 +0500 Subject: [PATCH] websocket development config --- src/services/signalr/index.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/services/signalr/index.ts b/src/services/signalr/index.ts index 91d7082..449cd65 100644 --- a/src/services/signalr/index.ts +++ b/src/services/signalr/index.ts @@ -12,14 +12,19 @@ type ConnectionsDict = { [route: string]: HubConnection; }; +//var baseUrl = `http://192.168.1.70:5000` +var baseUrl = process.env.NODE_ENV === 'development' + ?'http://192.168.1.70:5000' + :'' + const Connections: ConnectionsDict = { 'hubs/telemetry': new HubConnectionBuilder() - .withUrl(`http://192.168.1.70:5000/hubs/telemetry`, ConnectionOptions)// + .withUrl(`${baseUrl}/hubs/telemetry`, ConnectionOptions)// .withAutomaticReconnect() .build(), 'hubs/reports': new HubConnectionBuilder() - .withUrl(`http://192.168.1.70:5000/hubs/reports`, ConnectionOptions) + .withUrl(`${baseUrl}/hubs/reports`, ConnectionOptions) .withAutomaticReconnect() .build() }