In #18, a change was made to exclude the aps key if it is empty. This causes totally empty notifications to fail (for example, when pushing to an Apple Wallet pass to trigger an update). The correct behavior to would be to include the empty aps key encoded as a JSON object, like this:
{
"aps": {}
}
This PR fixes this by always including the "aps" key and casting $aps to an object, so that in the event it is empty it will be correctly encoded as an empty JSON object, rather that an empty JSON array as mentioned in #18.
For each notification, compose a JSON dictionary object (as defined by RFC 4627). This dictionary must contain another dictionary identified by the aps key.
In #18, a change was made to exclude the
aps
key if it is empty. This causes totally empty notifications to fail (for example, when pushing to an Apple Wallet pass to trigger an update). The correct behavior to would be to include the emptyaps
key encoded as a JSON object, like this:This PR fixes this by always including the
"aps"
key and casting$aps
to an object, so that in the event it is empty it will be correctly encoded as an empty JSON object, rather that an empty JSON array as mentioned in #18.Reference: