Gracefully handle remote WebSocket disconnections.#121
Open
adderthorn wants to merge 5 commits intoglacasa:mainfrom
Open
Gracefully handle remote WebSocket disconnections.#121adderthorn wants to merge 5 commits intoglacasa:mainfrom
adderthorn wants to merge 5 commits intoglacasa:mainfrom
Conversation
Adds a boolean property to the `TimelineStreaming` class to specify reconnection of a stream if disconnected. This is used with a new try/catch block to gracefully handle a `WebSocketException` and either stop the stream or attempt a reconnect.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a boolean property to the
TimelineStreamingclass to specify reconnection of a stream if disconnected. This is used with a new try/catch block to gracefully handle aWebSocketExceptionand either stop the stream or attempt a reconnect.I have been working on an application that uses this library and uses the Web Socket streaming. I found after ~2 hours my remote server would unexpectedly close the connection resulting in a crash. I've solved this myself adding this try/catch to catch the websocket exception and either gracefully close the stream or reconnect depending on a flag.
I'm open to other thoughts on how to handle this, and I'm not sure I love the property on the abstract class, but wanted to keep it simple so that, if there's a solution that works better for the project, it would be easy to change. Let me know what you think.