According to the specification, the connection object to be passed as input parameter in apns_connection:init/1 is:
-type connection() :: #{ name := name()
, apple_host := host()
, apple_port := inet:port_number()
, certdata => binary()
, certfile => path()
, keydata => keydata()
, keyfile => path()
, timeout => integer()
, type := type()
, proxy_info => proxy_info()
}.
As I read it, the field timeout is optional, not mandatory. However, my apns_connection crashes later when I attempt to send a push notification due to the fact it's not pattern matching correctly the field in:
|
#{timeout := Timeout} = Connection, |
I see two options:
- use
maps:find/3 providing a default value
- in init, ensure the field is there or provide a default value
According to the specification, the connection object to be passed as input parameter in apns_connection:init/1 is:
As I read it, the field
timeoutis optional, not mandatory. However, myapns_connectioncrashes later when I attempt to send a push notification due to the fact it's not pattern matching correctly the field in:apns4erl/src/apns_connection.erl
Line 311 in 10b88a8
I see two options:
maps:find/3providing a default value