mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
support wss for websockets
This commit is contained in:
parent
473f511665
commit
143ba85be6
1 changed files with 8 additions and 2 deletions
|
|
@ -19,9 +19,15 @@ export const WebsocketProvider = ({ children }) => {
|
|||
const ws = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
let wsUrl = `ws://${window.location.host}/ws/`;
|
||||
let wsUrl = `${window.location.host}/ws/`;
|
||||
if (process.env.REACT_APP_ENV_MODE == 'dev') {
|
||||
wsUrl = `ws://${window.location.hostname}:8001/ws/`;
|
||||
wsUrl = `${window.location.hostname}:8001/ws/`;
|
||||
}
|
||||
|
||||
if (window.location.protocol.match(/https/)) {
|
||||
wsUrl = `wss://${wsUrl}`;
|
||||
} else {
|
||||
wsUrl = `ws://${wsUrl}`;
|
||||
}
|
||||
|
||||
const socket = new WebSocket(wsUrl);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue