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

retry realtime on error #212

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

retry realtime on error #212

wants to merge 4 commits into from

Conversation

lohanidamodar
Copy link
Member

@lohanidamodar lohanidamodar commented Jul 18, 2024

What does this PR do?

  • Automatically reconnect realtime connection

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

Have you read the Contributing Guidelines on issues?

YES

Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

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

How did you test this? I tried using android emulator and turning on and off airplane mode, but it seemed like the onDone and onError was never called.

lib/src/realtime_mixin.dart Show resolved Hide resolved
@lohanidamodar
Copy link
Member Author

lohanidamodar commented Aug 1, 2024

How did you test this? I tried using android emulator and turning on and off airplane mode, but it seemed like the onDone and onError was never called.

That's exactly what I did, turn off internet, wait for few seconds and turn on again, it works for me. For me onDone was called

Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

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

hmm so in dartpad the switch expression works and the docs say you just need dart 3.0 for it to work, but it isn't working locally for me on dart 3.3:
image
did you see this?

@lohanidamodar
Copy link
Member Author

hmm so in dartpad the switch expression works and the docs say you just need dart 3.0 for it to work, but it isn't working locally for me on dart 3.3: image did you see this?

I'm sure it's because of this

sdk: '>=2.17.0 <4.0.0'

So I will revert it back, as we want it to be compatible with old Dart versions as long as possible.

Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

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

turn off internet

Can you clarify what you did exactly so I can reproduce? Did you test on an emulator or physical device? I still can't reproduce. Here's a screenshot of airplane mode on, a log entry for a successful subscription, but no log entry for disconnect/retry:
image

@lohanidamodar
Copy link
Member Author

turn off internet

Can you clarify what you did exactly so I can reproduce? Did you test on an emulator or physical device? I still can't reproduce. Here's a screenshot of airplane mode on, a log entry for a successful subscription, but no log entry for disconnect/retry: image

Here's what I did on emulator

  1. Connect and subscribe
  2. Disconnect Wifi/Internet (Didn't try Airplane mode, but it should be same)
  3. Wait for few seconds
  4. Open wifi again
  5. Create document
  6. You should see the realtime log update

Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

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

@lohanidamodar, hmm it's working now 🤷🏼

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

Successfully merging this pull request may close these issues.

2 participants