Poprawiono łączność websocketów

This commit is contained in:
2022-04-09 17:42:11 +02:00
parent 5dbbe84dfc
commit 0752b44402
+9 -2
View File
@@ -20,10 +20,17 @@ import { getLocoURL, getScheduledTrain, getStatusID, getStatusTimestamp, parseSp
import { URLs } from '@/scripts/utils/apiURLs'; import { URLs } from '@/scripts/utils/apiURLs';
import ScheduledTrain from '@/scripts/interfaces/ScheduledTrain'; import ScheduledTrain from '@/scripts/interfaces/ScheduledTrain';
import StationRoutes from '@/scripts/interfaces/StationRoutes'; import StationRoutes from '@/scripts/interfaces/StationRoutes';
import { connect } from 'socket.io-client'; import { connect, io } from 'socket.io-client';
const connectToDevAPI = true;
// Websocket config // Websocket config
const socket = connect(process.env.NODE_ENV === 'production' ? URLs.stacjownikAPI : URLs.stacjownikAPIDev) const socket = io(process.env.NODE_ENV === 'production' || connectToDevAPI ? URLs.stacjownikAPI : URLs.stacjownikAPIDev,
{
transports: ["websocket", "polling"],
rememberUpgrade: true
})
socket.emit('connection'); socket.emit('connection');
export interface State { export interface State {