Comparisons
In the following "FCM" and "APNs" are respectively the common abbreviations for Firebase Cloud Messaging and Apple Push Notification service.
FCM and APNs documented comparisons
- FCM responds with a unique notification identifier in the response body, APNs responds with this identifier in the headers.
- FCM always uses token authentication. APNs supports either ES256 JSON web tokens or certificate-based client authentication. An APNs signing key can cover multiple topics for one developer team, while certificate authentication requires a connection pool per certificate and environment pair.
FCM and APNs empirical comparisons
These observations were made and recorded during development. They're not substantiated by any official documentation and may be subject to change.
- FCM requires Application-Layer Protocol Negotiation (ALPN), APNs does not. (APNs is h2-only.) Without ALPN the
client sends a
GOAWAYerror 1 to FCM and closes the connection when negotiating HTTP. - FCM requires the
:authoritypseudo-header in every h2 request, even if this repeats the host in the URL. Without this FCM responds with a 400 and closes the stream. APNs is happy if this is omitted. - FCM allows up to 100 concurrent streams per h2 connection; APNs allows 1000.
- FCM frequently (though not always) replies with two
DATAframes upon a successful notification request: the first containing the response, the second an empty frame that also closes the stream. APNs responds with oneDATAframe that also closes the stream. - FCM sends a
GOAWAYframe (for error0xBand"too_many_pings") when it receives three consecutive pings without a request. It then closes the connection, regardless of the ping interval. APNs is apparently more relaxed, it has yet to exhibit this behaviour instead keeping connections open. - FCM sends a
GOAWAYframe (for"session_timeout") after four minutes of idling, and closes the connection; even after twenty minutes of idling, APNs still keeps connections open. - FCM sends a
GOAWAYframe (for"max_age") when a connection has been active for one hour and closes the connection; APNs keeps connections open. - FCM sends a ping immediately after closing the stream upon responding to a notification request. APNs does not send this ping.
- FCM has an internal timeout of 5 seconds and responds with a 500 internal server error status code when this is encountered.