[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:
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
