websocket-canvas/ts/websocket/websocket.ts

10 lines
217 B
TypeScript
Raw Permalink Normal View History

export function getWebsocketUrl(): string {
let scheme = 'ws';
if (document.location.protocol === 'https:') {
scheme += 's';
}
return scheme + '://' + document.location.hostname + ':8081';
}