-
Notifications
You must be signed in to change notification settings - Fork 40
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
feat: add offline mode #644
Conversation
d923619
to
0f9e49a
Compare
0f9e49a
to
8d14bfc
Compare
It requires |
Co-authored-by: Justin Fiedler <[email protected]>
export OfflineDisabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. Thanks @Mercy811. Really appreciate the test coverage.
See question about scheduling flush earlier on return to online.
add debug messages
We just noticed this landing, and we'll most definitely use this functionality to pause sending events, and just let them queue up. |
Hi @Multiply, thanks for choosing Amplitude and using the new feature! I will put it into our roadmap. Could you give me more context on the difference between the default |
Currently, I'm trying to set offline to disabled, and then set it to true via our own plugin, but it seems to result in the default plugin being loaded anyway. (Our plugin is most likely added first, and setup also called first, which is why the default one is still added) - Might be better to have a separate flag for disabling the default plugin? What we're trying to achieve is storing all events in the storage provider, until a user gives consent, instead of simply dropping events. Opting out doesn't quite do what we want, but the offline variable would. Essentially we just want to pause sending for a while. Edit: I succeeded in disabling the plugin, by moving my initialization into the |
Hi @Multiply,
|
Is there going to be react-native support for offline mode when the network drops out and automatically start sending once the connection returns? I would have expected that if the attempt to send the event fails due to a network error, it's not removed from the _unset array in the local storage. I'm a bit puzzled as to what the purpose of the |
Hi @cgibson-emesent, I also created a separate issue to track requests on supporting offline mode for React Native SDK. Please leave a comment there to help us better track customer requests. |
Summary
Add support for offline. When online, it behaves exactly the same as previous versions. When offline, tracking an event will not schedule a flush not will only be stored in storage. When back to online, the SDK will flush all stored events.
Offline feature is support by default
To opt of the default offline logic provided by network checker plugin
Checklist