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

Update api.go to implement websocket retry #187

Conversation

rollingonchrome
Copy link

Per my exchange with Donovon, I worked with ChatGPT to attempt to implement a websocket retry with exponential backoff.

@@ -122,7 +122,13 @@ func (bb *blueBubbles) PollForWebsocketMessages() {
if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {
bb.log.Error().Err(err).Msg("Error reading message from BlueBubbles websocket")
}
bb.log.Info().Msg("Attempting to reconnect to BlueBubbles websocket...")
err = bb.retryConnect()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not seeing the retryConnect function anywhere, do you have to make one?

  • I think you should probably do everything in lines 87-97 in retryConnect, the initial handshake is important
  • also would be a good idea to bake in a 5-10 sec sleep and Max retries. if the BB URL changes, which it does often, you don't want this looping aggressively forever

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cnuss we are actually talking about this in the mautrix-imessage channel already. ChatGPT just hallucinated on @rollingonchrome

@dltacube dltacube mentioned this pull request Feb 17, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants