Split from #277 (its cause 2). Causes 1 and 3 are fixed; this tracks the
remaining one.
Problem
The websocket can go completely silent — no Kind 38383, no kind-14, no
error, no reconnect — and the app never notices. Documented in #277: a
22-minute total silence during an active trade, recovered only by a manual
app restart; meanwhile the daemon's messages (the seller's turn to pay the
hold invoice) were missed and the order was canceled by timeout.
On Android we also observed both relays dropping together roughly every
60 seconds (connect/disconnect cycles in lockstep), which points to OS
power/network management killing the sockets rather than relay-side issues.
Proposed direction
- Investigate what nostr-sdk already offers (relay ping / health status /
auto-reconnect hooks) before building anything.
- A silence watchdog: if no event or EOSE arrives on the active
subscriptions for N minutes, force a reconnect + resubscribe under the
same stable subscription ids.
- Resubscribe on app resume (foreground transition), which is when the
Android socket kills are most likely to have happened.
Notes
Split from #277 (its cause 2). Causes 1 and 3 are fixed; this tracks the
remaining one.
Problem
The websocket can go completely silent — no Kind 38383, no kind-14, no
error, no reconnect — and the app never notices. Documented in #277: a
22-minute total silence during an active trade, recovered only by a manual
app restart; meanwhile the daemon's messages (the seller's turn to pay the
hold invoice) were missed and the order was canceled by timeout.
On Android we also observed both relays dropping together roughly every
60 seconds (connect/disconnect cycles in lockstep), which points to OS
power/network management killing the sockets rather than relay-side issues.
Proposed direction
auto-reconnect hooks) before building anything.
subscriptions for N minutes, force a reconnect + resubscribe under the
same stable subscription ids.
Android socket kills are most likely to have happened.
Notes
decrypts the missed kind-14 backlog correctly, so recovery is actually
effective — before it, reconnecting was not enough.