[lib] Retry Tunnelbroker connection after closing
Summary:
Details in ENG-9246.
Added a retry counter variable and a timeout.
- The effect hook has dependency on this variable
- It is increased after each retry
- Retry has to have interval to avoid infinite effect loop. Defaulted to 5s
Previously, effect wasn't triggered if socketState.connected was already false. Change false -> false doesn't trigger the hook, so socket wasn't recreated.
Test Plan:
- On native: Turned airplane mode on/off.
- On web: turned wifi on/off.
Observed console logs. The connection was successfully restored after network coming back.
Reviewers: kamil, tomek
Reviewed By: kamil
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D13382