Also support WebSocket SSL

This commit is contained in:
Mat 2024-10-20 11:12:18 +00:00
parent c3437ad30b
commit 24684d032e

View File

@ -7,7 +7,8 @@ export function createWebSocket<T>(
endpoint = ''
): Observable<T> {
return new Observable((observer) => {
const ws = new WebSocket(`ws://${host}:${wsPort}/${endpoint}`);
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const ws = new WebSocket(`${protocol}://${host}:${wsPort}/${endpoint}`);
ws.onmessage = (e) => {
const reader = new FileReader();
reader.onload = () => {