Hi, one question regarding the React Native SDK - ...
# support
e
Hi, one question regarding the React Native SDK - how does the automatic event flushing work? Should I be concerned with events not being delivered because the app is closed sooner than the SDK gets to sending the event batch? Do you have a recommended way of solving this? I see some approach for Android SDK, is there something similar for React Native?
k
Hey @eager-pizza-76165, We do not have the manual periodical flush support in RN SDK similar to Android SDK. But one thing which can be done is to tweak the values of
flushQueueSize
and
sleepTimeOut
while initializing the RN SDK to configure how often the events are flushed to your Dataplane. CC <!subteam^S04QT1G74Q3|@sdk-team>
@eager-pizza-76165, i missed informing you about the flush API we support in the RN SDK. However this is not the automatic one which periodically flushes like in the case of Android and needs to be called whenever needed
e
hi, yes, I'm aware of the flush API, just wanted to know whether there's a recommended way to call it, e.g. somehow listening to the "app background" event and calling flush just in time to make sure all of the events get send
k
listening to “app background” and calling
flush
automatically isn’t supported from the SDK. but however events are persisted in a DB by the SDK and sent to the Dataplane whenever the app is opened again. But if you want to send events ASAP, then you can updated the values of
flushQueueSize
and
sleepTimeOut
as per your requirement
e
right... I would ideally like to have the best of both worlds - not sending events too often, but also making sure we get all of them through when a user closes the app and doesn't get back for some time. anyway, thanks for your time here 🙂
k
yes, you are right, that’s a tradeoff. And that can be best decided depending on the use-case.