Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rocveralfre opened this issue Mar 26, 2021 · 0 comments

Comments

@rocveralfre
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant