Provide arguments to enable dispatcher handling of network errors#128
Open
whorfin wants to merge 1 commit intoLeggin:mainfrom
Open
Provide arguments to enable dispatcher handling of network errors#128whorfin wants to merge 1 commit intoLeggin:mainfrom
whorfin wants to merge 1 commit intoLeggin:mainfrom
Conversation
These are passed to the WebSocketApp run_forever() method to allow recovery from network errors
Author
|
To make this less academic, here's the sort of code I'm running now, and in testing so far it correctly reconnects both due to network problems and the "disconnected due to inactivity" issue It's only been a few disconnect/reconnects so far, but note that i did not see the This may also be helpful for #113 |
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.
This simple patch adds
dispatcherandreconnectarguments to create_event_listener()These are passed to the WebSocketApp
run_forever()method to allow recovery from network errorsSee https://github.com/websocket-client/websocket-client/tree/10d9159af9ba1ecb76e0ebb6a04edfd990eacbbb?tab=readme-ov-file#long-lived-connection
I've verified that if the websocket socket is closed due to network errors (as opposed to the DIRIGERA hub inactivity close, which is a "normal" status 1000 event), without this, the dirigera
create_event_listenerloop will exit.With these arguments, one can follow the method on the websocket-client README to use a dispatcher such as
relto handle this, and all is well.ps - thank you for contributing this library, it's been immensely helpful and i deeply appreciate it