Use wss for web socket when using a https connection

This commit is contained in:
Stash Dev 2019-02-14 16:28:12 -08:00
parent b488c1ed7d
commit 5730ba9125

View file

@ -58,9 +58,10 @@ export class StashService {
const platformUrl = new URL(platform.location.origin); const platformUrl = new URL(platform.location.origin);
platformUrl.port = platformUrl.protocol === 'https:' ? '9999' : '9998'; platformUrl.port = platformUrl.protocol === 'https:' ? '9999' : '9998';
const url = platformUrl.toString().slice(0, -1); const url = platformUrl.toString().slice(0, -1);
const webSocketScheme = platformUrl.protocol === 'https:' ? 'wss' : 'ws';
const wsLink = new WebSocketLink({ const wsLink = new WebSocketLink({
uri: `ws://${platform.location.hostname}:${platformUrl.port}/graphql`, uri: `${webSocketScheme}://${platform.location.hostname}:${platformUrl.port}/graphql`,
options: { options: {
reconnect: true reconnect: true
} }