android - Firebase save Traffic use with setPersistenceEnabled -
firebasedatabase.getinstance().setpersistenceenabled(true);
as understand it, firebase client keep local copy (on disk) of data app has listened to.
this firebase node
/users/userhash/privatetalk/messages/
example case
/users/user01-hash/privatetalk/messages/push-hash/hello /users/user01-hash/privatetalk/messages/push-hash/hi /users/user01-hash/privatetalk/messages/push-hash/hey
and i'm use addchildeventlistener
firebasedb.instance().chatdb.child("users").child("user01-hash").child("privatetalk").child("messages").addchildeventlistener(m_privatetalklistener);
on disk "hi", "hello", "hey"
server "hi" , "hello", "hey", "new msg 01", "new msg 02"
i'm wondering if app oncreate, firebase download "new msg 01", "new msg 02" server
firebase persistence creates on on disk cache can continue working firebase when application closes or goes offline. added message, "offline-message", not connect internet? firebase store write operation , new message in local cache. firebase treat local reference valid functions well. if had "child-added" event listener, still fire when child added local copy. when device re-establishes connection database, make of stored transactions , update stored values. same thing happen if user closed app before database sync: persist changes , make updates next time app opens , connected.
Comments
Post a Comment