May 20, 2016

Pigeon v0.6.0

Pigeon v0.6.0 is now released, containing many important syntax updates for APNS push notifications. This upgrade will break your existing Pigeon code for both GCM and APNS.

Pigeon v0.6.0

CamelCase push response keys now use snake_case (e.g. :BadDeviceToken -> :bad_device_token). Also, now returns a %Pigeon.APNS.Notification{} struct, a more reliable solution that better matches GCM notifications.

The new syntax is like so:

    device_token: nil,
    topic: nil,
    expiration: nil,
    payload: nil

payload is a map containing the exact payload sent to an iOS device. expiration is an optional attribute that indicates when it is no longer necessary to send the notification (expressed in seconds since the UNIX epoch). and /5 have been replaced with convenience methods to set badges, sounds, and other custom data.

For example:"your message", "your device token", "your push topic")
|> put_badge(5)
|> put_sound("default")
|> put_content_available
|> put_category("category")
|> put_custom(%{"your-custom-key" => %{"custom-value" => 500}})

Whats missing from the notification struct? id and priority keys that are common with other push APNS frameworks. These will be added in v0.7.0, as they are encoded slightly differently from the other request headers. There isn't a v1.0 elixir HTTP2 client yet, so a custom solution will need to be implemented. Without going into specifics, these two keys get cached in a special table that Pigeon and APNS servers must agree on. The benefit is that in subsequent uses of these headers, the encoded data is much smaller.

What else is new?

The APNS SSL connection can now be configured to use port 2197 instead of the usual 443. This is useful in cases where one would want to block 443 traffic but still send pushes. To enable it, set apns_2197: true in your config.exs

Pigeon is finally starting to resemble its final v1.0 form. Future updates from here out will focus more on reliability for HTTP2 connections with APNS.

Encounter any bugs or have a feature request? Don't hesitate to raise an issue!