any flutter devs out there? how do i make an app reconnect and resubscribe to relays after the app has been backgrounded / slept. this is my largest hurdle with the divine flutter app.

Reply to this note

Please Login to reply.

Discussion

Yeah, man. Not a great option for this. What we are doing is just pinging the device for a set period of time.

For example, you could ping it after 6 hours, then 24 hours, then a week, then every month.

That's the only solution I've been able to find.

It should be managed by nostr-sdk on flutter

this is the one we're using. https://github.com/rabble/nostr_sdk

I used https://github.com/relaystr/ndk for zap.stream / freeflow apps

i used rx_dart to get realtime updates using a class like this: https://github.com/nostrlabs-io/zap-stream-flutter/blob/main/lib/rx_filter.dart

https://api.flutter.dev/flutter/widgets/WidgetsBindingObserver-class.html

This might be what you are looking for. You can detect fore/background state.