[Bug]: socket disconnect if downloading from pc to phone no background functionality. #3075

Open
opened 2026-04-25 00:13:31 +02:00 by adam · 6 comments
Owner

Originally created by @noobie158 on GitHub (Nov 6, 2025).

What happened?

When downloading from my pc to my phone. randomly disconnects and reconnects from server. This causes the download to hang and not resume afterwards

What did you expect to happen?

i expect the app to keep downloading in the background. and keep the connection alive.

Steps to reproduce the issue

  1. download series at once then go to another app or turn the screen off.
  2. open up the app or go back to the app
  3. downloads have stalled

Audiobookshelf version

10.1

How are you running audiobookshelf?

android

What OS is your Audiobookshelf server hosted from?

Windows

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Chrome

Logs

[2025-11-06 01:11:24.966] INFO: [SocketAuthority] Socket oW8dFGHQ_AuOhT_HAAAP disconnected from client "Tom" after 354554ms (Reason: transport close)
[2025-11-06 01:11:29.251] INFO: [SocketAuthority] Socket Connected to /socket.io Ou0N2QAEFBe3QCyPAAAR
[2025-11-06 01:11:40.797] INFO: [LibraryItemController] User "Tom" requested download for item
[2025-11-06 01:11:40.798] INFO: [LibraryItemController] User "Tom" requested download for item 
[2025-11-06 01:11:40.799] INFO: [LibraryItemController] User "Tom" requested download for item 
[2025-11-06 01:16:51.991] INFO: [SocketAuthority] Socket 4rlj0EcZVyyKC3ULAAAL disconnected from client "Tom" after 2764624ms (Reason: transport close)
[2025-11-06 01:16:52.907] INFO: [SocketAuthority] Socket Connected to /audiobookshelf/socket.io 02SaP1Q0_OuqjTxrAAAT
[2025-11-06 01:22:07.875] INFO: [SocketAuthority] Socket 02SaP1Q0_OuqjTxrAAAT disconnected from client "Tom" after 314968ms (Reason: transport close)
[2025-11-06 01:22:09.398] INFO: [SocketAuthority] Socket Connected to /audiobookshelf/socket.io yBYSo5p92jen-D0nAAAV

Additional Notes

this is a priority. the bug breaks core functionality. make a keep socket alive function in the app if downloading.

example
https://gist.github.com/igorzi/2931446

Originally created by @noobie158 on GitHub (Nov 6, 2025). ### What happened? When downloading from my pc to my phone. randomly disconnects and reconnects from server. This causes the download to hang and not resume afterwards ### What did you expect to happen? i expect the app to keep downloading in the background. and keep the connection alive. ### Steps to reproduce the issue 1. download series at once then go to another app or turn the screen off. 2. open up the app or go back to the app 3. downloads have stalled 4. ### Audiobookshelf version 10.1 ### How are you running audiobookshelf? android ### What OS is your Audiobookshelf server hosted from? Windows ### If the issue is being seen in the UI, what browsers are you seeing the problem on? Chrome ### Logs ```shell [2025-11-06 01:11:24.966] INFO: [SocketAuthority] Socket oW8dFGHQ_AuOhT_HAAAP disconnected from client "Tom" after 354554ms (Reason: transport close) [2025-11-06 01:11:29.251] INFO: [SocketAuthority] Socket Connected to /socket.io Ou0N2QAEFBe3QCyPAAAR [2025-11-06 01:11:40.797] INFO: [LibraryItemController] User "Tom" requested download for item [2025-11-06 01:11:40.798] INFO: [LibraryItemController] User "Tom" requested download for item [2025-11-06 01:11:40.799] INFO: [LibraryItemController] User "Tom" requested download for item [2025-11-06 01:16:51.991] INFO: [SocketAuthority] Socket 4rlj0EcZVyyKC3ULAAAL disconnected from client "Tom" after 2764624ms (Reason: transport close) [2025-11-06 01:16:52.907] INFO: [SocketAuthority] Socket Connected to /audiobookshelf/socket.io 02SaP1Q0_OuqjTxrAAAT [2025-11-06 01:22:07.875] INFO: [SocketAuthority] Socket 02SaP1Q0_OuqjTxrAAAT disconnected from client "Tom" after 314968ms (Reason: transport close) [2025-11-06 01:22:09.398] INFO: [SocketAuthority] Socket Connected to /audiobookshelf/socket.io yBYSo5p92jen-D0nAAAV ``` ### Additional Notes this is a priority. the bug breaks core functionality. make a keep socket alive function in the app if downloading. example https://gist.github.com/igorzi/2931446
adam added the bug label 2026-04-25 00:13:31 +02:00
Author
Owner

@sir-wilhelm commented on GitHub (Nov 6, 2025):

I think this might be a duplicate of https://github.com/advplyr/audiobookshelf-app/issues/34

Sounds like "issue downloading when changing networks.

If this happens to you often/you can easily reproduce this you might be able to test nichwall's potential fix, but I know he's still been iterating on it, so it might not be fully ready to test.

@sir-wilhelm commented on GitHub (Nov 6, 2025): I think this might be a duplicate of https://github.com/advplyr/audiobookshelf-app/issues/34 Sounds like "issue downloading when changing networks. If this happens to you often/you can easily reproduce this you might be able to test nichwall's potential fix, but I know he's still been iterating on it, so it might not be fully ready to test.
Author
Owner

@noobie158 commented on GitHub (Nov 6, 2025):

No different issue. I am saying that just switching between apps or turning of your screen breaks the downloads in progress. You need to keep the screen on and in the app to complete download. There is no resume or keep connection alive (hartbeat) function on the server so the downloads fail almost instantly if your screen inactivity is set to 15 seconds in the android app. To fix this hartbeat websocket should be created on the server to keep websocket alive when turning screen off or switching apps.

@noobie158 commented on GitHub (Nov 6, 2025): No different issue. I am saying that just switching between apps or turning of your screen breaks the downloads in progress. You need to keep the screen on and in the app to complete download. There is no resume or keep connection alive (hartbeat) function on the server so the downloads fail almost instantly if your screen inactivity is set to 15 seconds in the android app. To fix this hartbeat websocket should be created on the server to keep websocket alive when turning screen off or switching apps.
Author
Owner

@nichwall commented on GitHub (Nov 6, 2025):

No different issue. I am saying that just switching between apps or turning of your screen breaks the downloads in progress. You need to keep the screen on and in the app to complete download. There is no resume or keep connection alive (hartbeat) function on the server so the downloads fail almost instantly if your screen inactivity is set to 15 seconds in the android app. To fix this hartbeat websocket should be created on the server to keep websocket alive when turning screen off or switching apps.

There are several issues for this already open in the app repository. Background downloading is not currently supported, but I'm hoping to add it after refactoring more of the Android download logic. It will probably still be a while before it's done.

@nichwall commented on GitHub (Nov 6, 2025): > No different issue. I am saying that just switching between apps or turning of your screen breaks the downloads in progress. You need to keep the screen on and in the app to complete download. There is no resume or keep connection alive (hartbeat) function on the server so the downloads fail almost instantly if your screen inactivity is set to 15 seconds in the android app. To fix this hartbeat websocket should be created on the server to keep websocket alive when turning screen off or switching apps. There are several issues for this already open in the app repository. Background downloading is not currently supported, but I'm hoping to add it after refactoring more of the Android download logic. It will probably still be a while before it's done.
Author
Owner

@noobie158 commented on GitHub (Nov 6, 2025):

Can you give me a timeline? When this wil be fixed

@noobie158 commented on GitHub (Nov 6, 2025): Can you give me a timeline? When this wil be fixed
Author
Owner

@nichwall commented on GitHub (Nov 6, 2025):

When it is done. This is a project we work on in our free time as time allows. I'm hoping to have it done in the next few weeks, but I initially started the Android download refactor about 5 months ago.

@nichwall commented on GitHub (Nov 6, 2025): When it is done. This is a project we work on in our free time as time allows. I'm hoping to have it done in the next few weeks, but I initially started the Android download refactor about 5 months ago.
Author
Owner

@Chriss78 commented on GitHub (Mar 22, 2026):

Hello hoping you could achive some progeress with this issue. I have also expirienced this issue with both clients android and iOS. And iOS is agressively stop network traffic as soon as you switch apps or the screen sleeps Android has some seconds until it also stops pause the DL. I think it could be solved with a notification I know some other apps do this to be allowed to run in the background. I could be wrong I'm no expert. But hoping to give some ideas or any help.

@Chriss78 commented on GitHub (Mar 22, 2026): Hello hoping you could achive some progeress with this issue. I have also expirienced this issue with both clients android and iOS. And iOS is agressively stop network traffic as soon as you switch apps or the screen sleeps Android has some seconds until it also stops pause the DL. I think it could be solved with a notification I know some other apps do this to be allowed to run in the background. I could be wrong I'm no expert. But hoping to give some ideas or any help.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#3075