@@ -1182,7 +1182,7 @@ function App() {
|
||||
// WebSocket for live status
|
||||
useEffect(() => {
|
||||
function connect() {
|
||||
const ws = new WebSocket(`ws://${location.host}/ws`);
|
||||
const ws = new WebSocket(`${location.protocol === 'https:' ? 'wss:' : 'ws:'}//${location.host}/ws`);
|
||||
ws.onopen = () => setWsStatus(s => ({ ...s, connected: true }));
|
||||
ws.onclose = () => { setWsStatus(s => ({ ...s, connected: false })); setTimeout(connect, 3000); };
|
||||
ws.onerror = () => ws.close();
|
||||
|
||||
Reference in New Issue
Block a user