From 4aa66f41568be6f7cf27ebc9fbf137cfb50b5036 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Sun, 19 Jun 2022 09:33:10 -0500 Subject: [PATCH] Fixed issue socket-io cannot be connected in production build on web --- server/apps/immich/src/api-v1/asset/asset.service.ts | 1 + web/src/lib/components/asset-viewer/immich-thumbnail.svelte | 1 - web/src/lib/stores/websocket.ts | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/apps/immich/src/api-v1/asset/asset.service.ts b/server/apps/immich/src/api-v1/asset/asset.service.ts index 20390b3cbc..59743cf023 100644 --- a/server/apps/immich/src/api-v1/asset/asset.service.ts +++ b/server/apps/immich/src/api-v1/asset/asset.service.ts @@ -244,6 +244,7 @@ export class AssetService { } /** Sending Partial Content With HTTP Code 206 */ + console.log('Send Range', range); res.status(206).set({ 'Content-Range': `bytes ${start}-${end}/${size}`, 'Accept-Ranges': 'bytes', diff --git a/web/src/lib/components/asset-viewer/immich-thumbnail.svelte b/web/src/lib/components/asset-viewer/immich-thumbnail.svelte index 04fc4a54ab..2c5bd2da07 100644 --- a/web/src/lib/components/asset-viewer/immich-thumbnail.svelte +++ b/web/src/lib/components/asset-viewer/immich-thumbnail.svelte @@ -52,7 +52,6 @@ method: 'GET', headers: { Authorization: 'bearer ' + $session.user.accessToken, - 'Accept-Range': 'bytes', }, }); diff --git a/web/src/lib/stores/websocket.ts b/web/src/lib/stores/websocket.ts index d37f220922..ddae1b0886 100644 --- a/web/src/lib/stores/websocket.ts +++ b/web/src/lib/stores/websocket.ts @@ -5,7 +5,7 @@ import { assets } from './assets'; export const openWebsocketConnection = (accessToken: string) => { const websocket = io(serverEndpoint, { - transports: ['polling'], + transports: ['websocket', 'polling'], reconnection: true, forceNew: true, autoConnect: true,