Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConnnectivityOnLifecycle does not close / re-open socket connection #56

Closed
raylee4204 opened this issue Jan 15, 2019 · 11 comments
Closed

Comments

@raylee4204
Copy link

When using Scarlet with OkHttp websocket + AndroidLifecycle with `ofApplicationForeground in the configs, putting the app in the background and bringing back forward closes & re-initiates the connection.

However, turning on/off the airplane mode does not close & re-initiate the socket connection.

@zhxnlai
Copy link
Collaborator

zhxnlai commented Jan 15, 2019

@raylee4204 What version of Scarlet are you using? 0.1.6 or 0.2.1-alpha5?

@raylee4204
Copy link
Author

raylee4204 commented Jan 15, 2019

both tried 0.2.1-alpha4 and alpha5

@raylee4204
Copy link
Author

raylee4204 commented Jan 16, 2019

State transition when turning on the airplane mode: StateTransition(fromState=com.tinder.scarlet.State$Connected, event=OnLifecycleStateChange(lifecycleState=com.tinder.scarlet.LifecycleState$Stopped), toState=Disconnecting(shouldRetry=true), sideEffect=com.tinder.scarlet.SideEffect$CloseProtocol)

A minute later:
StateTransition(fromState=Disconnecting(shouldRetry=true), event=OnProtocolEvent(protocolEvent=OnFailed(shouldRetry=true, throwable=java.io.EOFException)), toState=com.tinder.scarlet.State$Disconnected, sideEffect=null)

State transition for app in background:

StateTransition(fromState=com.tinder.scarlet.State$Connected, event=OnLifecycleStateChange(lifecycleState=com.tinder.scarlet.LifecycleState$Stopped), toState=Disconnecting(shouldRetry=true), sideEffect=com.tinder.scarlet.SideEffect$CloseProtocol)

StateTransition(fromState=Disconnecting(shouldRetry=true), event=OnProtocolEvent(protocolEvent=OnClosing(response=CloseResponse(shutdownReason=ShutdownReason(code=1000, reason=)))), toState=Disconnecting(shouldRetry=true), sideEffect=null)

StateTransition(fromState=Disconnecting(shouldRetry=true), event=OnProtocolEvent(protocolEvent=OnClosed(response=CloseResponse(shutdownReason=ShutdownReason(code=1000, reason=)))), toState=com.tinder.scarlet.State$Disconnected, sideEffect=null)

@zhxnlai
Copy link
Collaborator

zhxnlai commented Jan 17, 2019

@raylee4204 Just released 0.2.2-alpha3 to address this issue. Would you let me know if works?

@raylee4204
Copy link
Author

It doesn't seem like it's available on jitpack

@zhxnlai
Copy link
Collaborator

zhxnlai commented Jan 17, 2019

@raylee4204 The publish script timed out due to a flaky test. Sorry about the confusion! Could you check out 0.2.2-alpha4 instead?

@raylee4204
Copy link
Author

raylee4204 commented Jan 17, 2019 via email

@raylee4204
Copy link
Author

This still does not work.

@zhxnlai
Copy link
Collaborator

zhxnlai commented Jan 22, 2019

@raylee4204 I was not able to reproduce the behavior in the demo app. As you can see in the video attached, Iogs show up as expected when I turn airplane mode on and off. Could you help me reproduce it in the demo app?
device-2019-01-21-225427.webm.zip

@raylee4204
Copy link
Author

Confirmed it's working again. Thanks for your help!

@zhxnlai
Copy link
Collaborator

zhxnlai commented Jan 22, 2019

👍👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants