gpt4 book ai didi

Meteor raix 推送通知因无连接而丢失

转载 作者:行者123 更新时间:2023-12-02 06:39:36 25 4
gpt4 key购买 nike

我正在使用push iOS 和 Android 版 meteor 应用程序中的通知。如果我向其发送通知的用户已连接到互联网,则效果很好。问题是,如果我向离线用户发送通知,并且当他在几个小时后连接到互联网时,通知不会发送。关于如何克服这个问题的任何见解。以下是我发送通知的代码:

Push.send({
from: '1234',
title: title,
text: text,
notId : nId,
gcm: {
title: title,
style: 'inbox',
},
query: {
userId: {
$in: userIds
},
}
});

最佳答案

我在您提供的 gitRepo 中找不到 TTL(生存时间)选项。通常有一个选项。您可以在此处阅读更多相关信息 concept options

更新
New Link

Lifetime of a message

When an app server posts a message to FCM and receives a message ID back, it does not mean that the message was already delivered to the device. Rather, it means that it was accepted for delivery. What happens to the message after it is accepted depends on many factors.

In the best-case scenario, if the device is connected to FCM, the screen is on and there are no throttling restrictions, the message is delivered right away.

If the device is connected but in Doze, a low priority message is stored by FCM until the device is out of Doze. And that's where the collapse_key flag plays a role: if there is already a message with the same collapse key (and registration token) stored and waiting for delivery, the old message is discarded and the new message takes its place (that is, the old message is collapsed by the new one). However, if the collapse key is not set, both the new and old messages are stored for future delivery.

If the device is not connected to FCM, the message is stored until a connection is established (again respecting the collapse key rules). When a connection is established, FCM delivers all pending messages to the device. If the device never gets connected again (for instance, if it was factory reset), the message eventually times out and is discarded from FCM storage. The default timeout is four weeks, unless the time_to_live flag is set.

To get more insight into the delivery of a message:

  1. For Android and iOS: See the FCM reporting dashboard, which records the number of messages sent and opened on iOS and Android devices, along with data for "impressions" (notifications seen by users) for Android apps.
  2. For Android: If you'd like to be notified when the application successfully receives a message, you can use delivery_receipt_requested functionality following the guidelines. This requires you to setup an XMPP server.
  3. For Android, iOS and Web: You can use InstanceID APIs to check the most recent date that the device you're targeting through the FCM registration token has established a connection with FCM.

关于Meteor raix 推送通知因无连接而丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49644871/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com