Scarlet icon indicating copy to clipboard operation
Scarlet copied to clipboard

One time urls? Disable reconnecting?

Open ursusursus opened this issue 6 years ago • 1 comments

Hi, my backend generates a wss:// url for me, which however is a one time thing, meaning upon connetion lost, I wont be able to reconnect, which is what Im seeing with Scarlet, (infinite loop of WaitingToRetry, Connecting)

Is there way to disable the reconnecting policy and Ill maybe handle connecting back manually? Since I need to call backend api again to generate a new wss:// url

Thanks

ursusursus avatar Mar 21 '19 02:03 ursusursus

Yes. You can try my lib, it's config with Scartlet 0.2.x while waiting for my Pull request to be approved. https://github.com/hantrungkien/tinder-scarlet-lifecycle-android Its purpose is to make sure Scartlet completes when there is a Lifecycle event completed. You must have custom one Lifecycle like a LoggedInLifecycle in demo project.

zhxnlai said that:

Yes it is possible. The WebSocket echo demo has a Login/Logout button that turns the connection on and off.

The trick is to define a custom lifecycle using the LifecycleRegistry class and have the UI modify it

hantrungkien avatar Apr 15 '19 06:04 hantrungkien