Firebase.ServerValue.TIMESTAMP returns different value on immediate child_added -


i have firebase push server timestamp, child_added listener listening.

extremely surprisingly, value returned child_added event ~300ms different in fact stored in firebase database node. subsequent reads @ same node, provides 'correct' time stored @ node. initial child_added event triggered right when push occurring, returning wrong time.

has observed issue?

ref = new firebase(/some/path); ref.on('child_added', function (childdata) {    console.log('childdata.pushtime = ' + childdata.pushtime); }); ref.push({pushtime: firebase.servervalue.timestamp}); 

what console.log prints off ~300ms in fact stored @ path.

the behaviour seeing expected behaviour.

it occurs because child_added event fired locally, using value servervalue.timestamp that's determined using local time , offset of local clock server clock. however, it's not possible account time take request arrive @ server - hence differing timestamps.

if listen child_changed event, fire snapshot includes correct time once write complete.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -