allowing for unfederated http

This commit is contained in:
Roland Osborne 2022-08-31 14:57:17 -07:00
parent f660ea6292
commit e70a02f53a

View File

@ -123,7 +123,15 @@ export function useAppContext() {
cardContext.actions.setToken(token); cardContext.actions.setToken(token);
channelContext.actions.setToken(token); channelContext.actions.setToken(token);
ws.current = new WebSocket("wss://" + window.location.host + "/status"); let protocol;
if (window.location.protocol === 'http') {
protocol = 'ws://';
}
else {
protocol = 'wss://';
}
ws.current = new WebSocket(protocol + window.location.host + "/status");
ws.current.onmessage = (ev) => { ws.current.onmessage = (ev) => {
try { try {
let rev = JSON.parse(ev.data); let rev = JSON.parse(ev.data);