[GH-ISSUE #100] Android: lost connection after a server restart with HTTP/JSON #81

Closed
opened 2026-05-07 00:19:36 +02:00 by BreizhHardware · 4 comments

Originally created by @MatMaul on GitHub (Jan 17, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/100

When restarting the server, my Android phone is silently loosing the connection.
Logs from the android app says the conn is alive but it's not. No subscribers in server logs and no messages is going down. Restarting the service by toggling the wakelock pref fixed it.
I haven't wait the 5mn timeout that would probably solve it, but it's longggg anyway :)

I can reproduce it all the time.

Originally created by @MatMaul on GitHub (Jan 17, 2022). Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/100 When restarting the server, my Android phone is silently loosing the connection. Logs from the android app says the conn is alive but it's not. No subscribers in server logs and no messages is going down. Restarting the service by toggling the wakelock pref fixed it. I haven't wait the 5mn timeout that would probably solve it, but it's longggg anyway :) I can reproduce it all the time.
Author
Owner

@MatMaul commented on GitHub (Jan 17, 2022):

Let's see if it's solved by some websocket magic 🤞 .

<!-- gh-comment-id:1014415371 --> @MatMaul commented on GitHub (Jan 17, 2022): Let's see if it's solved by some websocket magic :crossed_fingers: .
Author
Owner

@MatMaul commented on GitHub (Jan 17, 2022):

It was still not working after the 5mn timeout.
However websocket recovered pretty quickly (less than 10s) \o/

<!-- gh-comment-id:1014494265 --> @MatMaul commented on GitHub (Jan 17, 2022): It was still not working after the 5mn timeout. However websocket recovered pretty quickly (less than 10s) \o/
Author
Owner

@binwiederhier commented on GitHub (Jan 17, 2022):

Yeah sort of the reason why I want to switch to the websockets way is because I am incredibly unhappy with how I implemented the HTTP JSON stream. It should eventually recover, but it can take a little time. If the connection breaks it should be only a few seconds though.

If the connection is just silently taken away (like apparently the Huawei phone from Jakob did), it has to wait up to 30s+5min, so quite the long time.

If the 5min timeout is not working for you that's odd. I am not sure how much time I want to spend debugging it, since I want to switch to websockets anyway...

<!-- gh-comment-id:1014543050 --> @binwiederhier commented on GitHub (Jan 17, 2022): Yeah sort of the reason why I want to switch to the websockets way is because I am incredibly unhappy with how I implemented the HTTP JSON stream. It should eventually recover, but it can take a little time. If the connection breaks it should be only a few seconds though. If the connection is just silently taken away (like apparently the Huawei phone from Jakob did), it has to wait up to 30s+5min, so quite the long time. If the 5min timeout is not working for you that's odd. I am not sure how much time I want to spend debugging it, since I want to switch to websockets anyway...
Author
Owner

@MatMaul commented on GitHub (Jan 17, 2022):

Yeah let's not bother and harden the ws one I would say.

<!-- gh-comment-id:1014564369 --> @MatMaul commented on GitHub (Jan 17, 2022): Yeah let's not bother and harden the ws one I would say.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ntfy#81
No description provided.