Pigeon (Pigeon v2.0.0-rc.0) View Source
HTTP2-compliant wrapper for sending iOS and Android push notifications.
Getting Started
Check the module documentation for your push notification service.
Pigeon.ADM
- Amazon Android.Pigeon.APNS
- Apple iOS.Pigeon.FCM
- Firebase Cloud Messaging v1 API.Pigeon.LegacyFCM
- Firebase Cloud Messaging Legacy API.
Creating Dynamic Runtime Dispatchers
Pigeon can spin up dynamic dispatchers for a variety of advanced use-cases, such as supporting dozens of dispatcher configurations or custom connection pools.
See Pigeon.Dispatcher
for instructions.
Writing a Custom Dispatcher Adapter
Want to write a Pigeon adapter for an unsupported push notification service?
See Pigeon.Adapter
for instructions.
Link to this section Summary
Functions
Returns the configured default pool size for Pigeon dispatchers. To customize this value, include the following in your config/config.exs
Returns the configured JSON encoding library for Pigeon. To customize the JSON library, include the following in your config/config.exs
Link to this section Types
Specs
notification() :: %{__meta__: Pigeon.Metadata.t()}
Specs
Async callback for push notifications response.
Examples
handler = fn(%Pigeon.ADM.Notification{response: response}) ->
case response do
:success ->
Logger.debug "Push successful!"
:unregistered ->
Logger.error "Bad device token!"
_error ->
Logger.error "Some other error happened."
end
end
n = Pigeon.ADM.Notification.new("token", %{"message" => "test"})
Pigeon.ADM.push(n, on_response: handler)
Specs
push_opts() :: [on_response: on_response() | nil, timeout: non_neg_integer()]
Options for sending push notifications.
:on_response
- Optional async callback triggered on receipt of push. Seeon_response/0
:timeout
- Push timeout. Defaults to 5000ms.
Link to this section Functions
Specs
default_pool_size() :: pos_integer()
Returns the configured default pool size for Pigeon dispatchers. To customize this value, include the following in your config/config.exs:
config :pigeon, :default_pool_size, 5
Specs
json_library() :: module()
Returns the configured JSON encoding library for Pigeon. To customize the JSON library, include the following in your config/config.exs:
config :pigeon, :json_library, Jason