Use wss for https connections

This commit is contained in:
Chen-I Lim 2021-01-25 16:56:00 -08:00
parent 2dd7848b9b
commit 4f3eb7239e

View File

@ -53,7 +53,8 @@ class OctoListener {
this.onChange = onChange
const url = new URL(this.serverUrl)
const wsServerUrl = `ws://${url.host}${url.pathname}ws/onchange`
const scheme = (url.protocol === 'https') ? 'wss' : 'ws'
const wsServerUrl = `${scheme}://${url.host}${url.pathname}ws/onchange`
Utils.log(`OctoListener open: ${wsServerUrl}`)
const ws = new WebSocket(wsServerUrl)
this.ws = ws