javascript - Save on FCM database message's timestamp -


so i'm using follow steps tutorial in order understant fcm , i'm wondering if there anyway save timestamp send/recieved messages?

google fcm tutorial page 8

 this.messagesref.push({       name: currentuser.displayname,       text: this.messageinput.value,       photourl: currentuser.photourl || '/images/profile_placeholder.png'     }) 

as can see on sample code push name, text , photourl want time.

use gettime() method, returns number of milliseconds between midnight of january 1, 1970 , specified date.

time: new date().gettime()

sample code:

this.messagesref.push({    name: currentuser.displayname,    text: this.messageinput.value,    photourl: currentuser.photourl || '/images/profile_placeholder.png',    time: new date().gettime() }) 

Comments

Popular posts from this blog

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

android - ConstraintLayout: Realign baseline constraint in case if dependent view visibility was set to GONE -

javascript - Confirm a form & display message if form is valid with JQuery -