Úprava socket.io pro relativní URL serveru
This commit is contained in:
parent
3c0e8b2297
commit
347cbc7228
@ -2,8 +2,10 @@ import React from 'react';
|
||||
import socketio from "socket.io-client";
|
||||
import { getBaseUrl } from "../Utils";
|
||||
|
||||
// Hack pro socket.io, který si s tečkou neumí poradit
|
||||
const socketUrl = getBaseUrl() === '.' ? '/' : getBaseUrl();
|
||||
// Záměrně omezeno jen na websocket, aby se případně odhalilo chybné nastavení proxy serveru
|
||||
export const socket = socketio.connect(getBaseUrl(), { transports: ["websocket"] });
|
||||
export const socket = socketio.connect(socketUrl, { transports: ["websocket"] });
|
||||
export const SocketContext = React.createContext();
|
||||
|
||||
// Konstanty websocket eventů, musí odpovídat těm na serveru!
|
||||
|
Loading…
x
Reference in New Issue
Block a user