Skip to content

Relay liveness watchdog: detect and recover dead subscriptions #291

Description

@Catrya

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority: mediumMedium priority

Type

No type

Projects

Status
Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions