Skip to content

timeout key is expected but its presence is not verified in apns_connection:init/1 #247

@rocveralfre

Description

@rocveralfre

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions