HomePhabricator

[Cashtab, chronik-client] Add and implement ws methods to support mobile app…

Description

[Cashtab, chronik-client] Add and implement ws methods to support mobile app backgrounding

Summary:
Mobile apps may control the behavior of websocket connections in unpredictable ways when an app is "backgrounded," e.g. when the user locks the screen or switches to a different app.

Because we cannot be sure how the OS will control the websocket in this condition, we should handle the connection and this event at the app level.

Because some low-level websocket handling is required to accomplish this, we wrap an effective practical solution in convenient public methods, tested in chronik-client.

These methods are implemented in Cashtab

Test Plan:
npm test to confirm we do not break existing behavior, ./start-android.sh and check logs through backgrounding, receive a tx after lock screen and unlock to confirm ws connection is live

Logs:

image.png (340×299 px, 46 KB)

Receive a tx after coming back from backgrounding, and notification appears

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18960

Details

Provenance
bytesofmanAuthored on Tue, Nov 18, 20:28
bytesofmanPushed on Thu, Nov 20, 22:15
Reviewer
Restricted Project
Differential Revision
D18960: [Cashtab, chronik-client] Add and implement ws methods to support mobile app backgrounding
Parents
rABC4948c69ca3d3: blockstorage: do not flush block to disk if it is already there
Branches
Unknown
Tags
Unknown