I success send push to device using firebase-admin node.js.
I called admin.messageing().sendToDevice(token, payload).then(function(response) {
console.log("Successfully sent message:", response);
});
I didn't using http call to calling admin.messageing().sendToDevice. I just call that function.
Next, I input CLI 'node app.js' for execute that function. Then, I success send message to device. but node process was not terminating.
Why the process not terminate?
kjwook@kjwook-15N540-RFLGL:~/node aa.js
Successfully sent message: { results: [ { messageId: '0:1506502554508960%254b46d6f9fd7ecd' } ],
failureCount: 0,
successCount: 1,
multicastId: 6370642410814556000 }
^[[C^[[A^[[D^[[B
SDK initialization (admin.initializeApp()) starts some background tasks, which keep the Node process alive. Call app.delete() to clean up and ensure graceful termination of all background tasks.
@hiranya911 what is the appropriate approach to send notifications in service like AWS Lambda or Firebase Functions, where it is imperative to end all activities ASAP? Closing the calling delete on the firebase instance seems way less than ideal. It can easily be forgotten.
Call app.delete() to clean up and ensure graceful termination of all background tasks.
How was the developer supposed to know they had to call app.delete()?
Most helpful comment
How was the developer supposed to know they had to call
app.delete()?