Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Remove hardcoded websocket host

Gabe Kangas9dcc3550bb74
diff --git a/web/services/websocket-service.ts b/web/services/websocket-service.ts
index db3e037ffa..0015c48980 100644
--- a/web/services/websocket-service.ts
+++ b/web/services/websocket-service.ts
@@ -37,7 +37,10 @@ export default class WebsocketService {
}
createAndConnect() {
- const url = new URL('ws://localhost:8080/ws');
+ const url = new URL(window.location.toString());
+ url.protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
+ url.pathname = '/ws';
+ url.port = window.location.port === '3000' ? '8080' : window.location.port;
url.searchParams.append('accessToken', this.accessToken);
console.debug('connecting to ', url.toString());
@@ -84,8 +87,8 @@ export default class WebsocketService {
if (this.handleMessage) {
this.handleMessage(socketEvent);
}
- } catch (e) {
- console.error(e, e.data);
+ } catch (err) {
+ console.error(err, err.data);
return;
}