Pigeon v1.1.1 Pigeon.APNS.Config View Source
Configuration for APNS Workers
Link to this section Summary
Link to this section Types
Link to this type
config_opts()
View Source
config_opts() :: [name: atom | nil, mode: :dev | :prod | nil, cert: binary | {atom, binary}, key: binary | {atom, binary}, reconnect: boolean, ping_period: pos_integer, port: pos_integer, uri: binary]
Options for configuring APNS connections.
:name
- Registered worker name.:mode
- If set to:dev
or:prod
, will set the appropriate:uri
:cert
- Push certificate. Can be one of three options:- Static file path
- Full-text string of the file contents (useful for environment variables)
{:my_app, "certs/cert.pem"}
(indicates path relative to thepriv
folder of the given application)
:key
- Push private key. Same as:cert
:uri
- Push server uri. If set, overrides uri defined by:mode
. Useful for test environments.:port
- Push server port. Can be any value, but APNS only accepts443
and2197
:ping_period
- Interval between server pings. Necessary to keep long running APNS connections alive. Defaults to 10 minutes.
Link to this type
t()
View Source
t() :: %Pigeon.APNS.Config{cert: binary | nil, certfile: binary | nil, key: binary | nil, keyfile: binary | nil, name: atom | nil, ping_period: pos_integer, port: pos_integer, reconnect: boolean, uri: binary | nil}
APNS configuration struct
This struct should not be set directly. Instead use new/1
with config_opts/0
.
Examples
%Pigeon.APNS.Config{
name: :apns_default,
reconnect: true,
cert: nil,
certfile: "cert.pem",
key: nil,
keyfile: "key.pem",
uri: "api.push.apple.com",
port: 443,
ping_period: 600_000
}
Link to this section Functions
Returns a new APNS.Config
with given opts
or name.
If given an atom, returns the config specified in your mix.exs
.
Examples
iex> Pigeon.APNS.Config.new(
...> name: :test,
...> mode: :prod,
...> cert: "test_cert.pem",
...> key: "test_key.pem",
...> reconnect: false,
...> port: 2197,
...> ping_period: 300_000
...> )
%Pigeon.APNS.Config{uri: "api.push.apple.com", name: :test,
ping_period: 300000, port: 2197, reconnect: false}
iex> config = Pigeon.APNS.Config.new(:apns_default)
iex> %{config | certfile: nil, keyfile: nil} # Hide for testing
%Pigeon.APNS.Config{uri: "api.development.push.apple.com",
name: :apns_default, ping_period: 600_000, port: 443, reconnect: false}