firebase 不总是通过 APNs 发送通知吗?

Is firebase not always sending notifications through APNs?

我注意到 firebase documentation 说了以下内容:

If a notification payload is provided, or the content_available option is set to true for a message to an iOS device, the message is sent through APNs, otherwise it is sent through the FCM connection server.

谁能解释一下这是什么意思?

我以为发送到 iOS 设备的所有推送通知,首先发送到 Apple,然后由 Apple 转发到相应的 device/s,但是这里暗示他们直接向设备发送消息?

当应用程序关闭 iOS 时,这甚至可能吗?

我很困惑, 谢谢。

根据我阅读文档后的理解,它可能试图说明:

如果可以推断通知是针对 iOS 设备(无论是来自通知负载还是内容可用密钥),它都会绕过 FCM 并获取直接发送到 APNS 进行优化,因为众所周知 100% 无论如何都会发送到 APNS。

否则,它将被发送到 FCM 并从那里路由到它应该去的地方。它可能仍然是 iOS 设备的通知并从 FCM 发送到 APNS,但无法推断。

当应用程序在前台时,FCM 可以直接连接,而不是通过 APNs 获取 data 类型的消息。正如您所期望的那样,在后台发送的消息通过 APNs 传送。如果您愿意,您实际上可以看看 source of the FCM client

您可以控制是否与 shouldEstablishDirectChannel 属性 一起使用。

从发送的角度来看,您不必对此过于担心 - 它会根据消息的类型以及是否有客户端连接作为 FCM 服务的一部分进行透明处理。