mirror of
https://github.com/tiqi-group/pydase.git
synced 2026-02-13 05:48:40 +01:00
frontend: getting correct hostname and port
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import { io } from 'socket.io-client';
|
||||
|
||||
const URL = 'ws://localhost:8001/';
|
||||
// process.env.NODE_ENV === 'production' ? undefined : 'ws://localhost:8001/ws';
|
||||
export const hostname =
|
||||
process.env.NODE_ENV === 'development' ? `localhost` : window.location.hostname;
|
||||
export const port =
|
||||
process.env.NODE_ENV === 'development' ? 8001 : window.location.port;
|
||||
const URL = `ws://${hostname}:${port}/`;
|
||||
console.debug('Websocket: ', URL);
|
||||
|
||||
export const socket = io(URL, { path: '/ws/socket.io', transports: ['websocket'] });
|
||||
|
||||
Reference in New Issue
Block a user