appwrite / sdk-for-flutter

[READ-ONLY] Official Appwrite Flutter SDK 💙
https://appwrite.io
BSD 3-Clause "New" or "Revised" License
369 stars 110 forks source link

retry realtime on error #212

Closed lohanidamodar closed 2 weeks ago

lohanidamodar commented 4 months ago

What does this PR do?

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

lohanidamodar commented 3 months ago

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

lohanidamodar commented 3 months ago

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 https://github.com/appwrite/sdk-for-flutter/blob/f40d4cbbaa767cfffa60b72b95f467fc4fcbc21f/pubspec.yaml#L16

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

lohanidamodar commented 3 months ago

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
puntiz commented 2 weeks ago

Was this fix for realtime reconnect not merged ?

lohanidamodar commented 2 weeks ago

Was this fix for realtime reconnect not merged ?

This is just a draft PR for testing. The fix is already merged and released.