mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-20 10:45:32 +02:00
Support servers with subdirectory
This commit is contained in:
parent
2452f09714
commit
16de3fdb97
4 changed files with 22 additions and 12 deletions
|
@ -26,14 +26,19 @@ class ServerSocket extends EventEmitter {
|
|||
this.serverAddress = serverAddress
|
||||
this.token = token
|
||||
|
||||
console.log('[SOCKET] Connect Socket', this.serverAddress)
|
||||
const serverUrl = new URL(serverAddress)
|
||||
const serverHost = `${serverUrl.protocol}//${serverUrl.host}`
|
||||
const serverPath = serverUrl.pathname === '/' ? '' : serverUrl.pathname
|
||||
|
||||
console.log(`[SOCKET] Connecting to ${serverHost} with path ${serverPath}/socket.io`)
|
||||
|
||||
const socketOptions = {
|
||||
transports: ['websocket'],
|
||||
upgrade: false,
|
||||
path: `${serverPath}/socket.io`
|
||||
// reconnectionAttempts: 3
|
||||
}
|
||||
this.socket = io(this.serverAddress, socketOptions)
|
||||
this.socket = io(serverHost, socketOptions)
|
||||
this.setSocketListeners()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue