Skip to content

Commit

Permalink
fix: Properly handle paths for websocket server
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Jul 5, 2024
1 parent 4407421 commit 1fb89d5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/collaboration/Portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ export class Portal {
}

connectSocket = () => {
const collabBackendUrl = loadState('whiteboard', 'collabBackendUrl', 'nextcloud.local:3002')
const collabBackendUrl = loadState('whiteboard', 'collabBackendUrl', '')

const token = localStorage.getItem(`jwt-${this.roomId}`) || ''

const socket = io(collabBackendUrl, {
const url = new URL(collabBackendUrl)
const path = url.pathname.replace(/\/$/, '') + '/socket.io'
const socket = io(url.origin, {
path,
withCredentials: true,
auth: {
token,
Expand Down

0 comments on commit 1fb89d5

Please sign in to comment.