1
Fork 0

Use secure websocket if api is https

This commit is contained in:
viktorstrate 2020-01-19 22:49:06 +01:00
parent 13f758a18b
commit aca472e40a
1 changed files with 2 additions and 1 deletions

View File

@ -15,7 +15,8 @@ const httpLink = new HttpLink({
console.log('GRAPHQL ENDPOINT', process.env.GRAPHQL_ENDPOINT)
let websocketUri = new URL(process.env.GRAPHQL_ENDPOINT)
websocketUri.protocol = 'ws'
websocketUri.protocol =
process.env.GRAPHQL_ENDPOINT.protocol === 'https:' ? 'wss:' : 'ws:'
const wsLink = new WebSocketLink({
uri: websocketUri,