mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 21:38:13 +00:00
Poprawiono łączność websocketów
This commit is contained in:
+9
-2
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user