Fixing websocket connection problem with new subpath feature

This commit is contained in:
Jesús Espino 2021-04-19 22:39:25 +02:00
parent 298141471c
commit 5dbc1d5a81

View file

@ -44,7 +44,7 @@ class OctoListener {
reopenDelay = 3000
constructor(serverUrl?: string, token?: string, readToken?: string) {
this.serverUrl = serverUrl || Utils.buildURL('', true)
this.serverUrl = serverUrl || Utils.buildURL('', true).replace(/\/$/, '')
this.token = token || localStorage.getItem('focalboardSessionId') || ''
this.readToken = readToken || OctoListener.getReadToken()
Utils.log(`OctoListener serverUrl: ${this.serverUrl}`)
@ -66,7 +66,7 @@ class OctoListener {
const url = new URL(this.serverUrl)
const protocol = (url.protocol === 'https:') ? 'wss:' : 'ws:'
const wsServerUrl = `${protocol}//${url.host}${url.pathname}/ws/onchange`
const wsServerUrl = `${protocol}//${url.host}${url.pathname}ws/onchange`
Utils.log(`OctoListener open: ${wsServerUrl}`)
const ws = new WebSocket(wsServerUrl)
this.ws = ws