-
Notifications
You must be signed in to change notification settings - Fork 215
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
[#136] README updated #141
Conversation
README.md
Outdated
|
||
This lib is intended to allow you to write an APNs provider for [Apple Push Notificaion services (APNs)](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html) over HTTP2 in Erlang. | ||
|
||
Copyright (c) 2017 Inaka Labs SRL <support@inaka.net>, released under the MIT license |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be Erlang Solutions Ltd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And Apache 2
README.md
Outdated
|
||
## Create connections | ||
|
||
After fill the `config` file and run `apns4erl` app we can start creating connections. As we mentioned before there are two types of connections. Both are created using the function `apns:connect/2` where the first argument is the type and the second one is the connection's name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fill -> filling, run -> running
README.md
Outdated
``` | ||
Note `cert` and `token` define the type we want. | ||
|
||
Although `Apns4erl` is supervising the connections `apns:connect/2` returns the connection `pid` just in case you wanted monitor it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wanted -> want to
README.md
Outdated
|
||
In order to send Notifications over `Provider Certificate` connection we will use `apns:push_notification/3,4`. | ||
|
||
We would need the connection, a notification, the device ID and some http2 headers. The connection is the `atom` we used when run `apns:connect/2` for setting a name, the device ID is provided by Apple, the notification is a `map` with the data we want to send, that map will be encoded to json later and the http2 headers can be explicitly sent as a parameter using `apns:push_notification/4` or can be defined at the `config` file, in that case we would use `apns:push_notification/3`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would -> will
when run -> when we executed
README.md
Outdated
|
||
## Push Notifications over `Provider Authentication Tokens` connections | ||
|
||
This is the other way APNs allows to send notifications. In this case we don't need a certificate but we will need a `p8` file with the private key we will use to sign the token. Lets suppose Apple provides us the file `APNsAuthKey_KEYID12345.p8`. We have to fill the `config` file key `token_keyfile` with the path to that file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allows -> allows you or allows us
Lets suppose -> Lets assume
Apple provides us the file … -> we've got the file … from Apple
We have -> We then have
README.md
Outdated
|
||
You can find more info [here](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) | ||
|
||
In order to push notification we will use `apns:push_notification_token/4,5`. we will need the same attributes we used sending a notification over `Provider Certificate` connections plus a signed `token`. This token has a 1 hour life, so that means we can generate one token and use it many times till it expires. Lets try. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
push notification -> push notifications or push a notification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
. we -> . We
we used sending -> we used when sending
README.md
Outdated
<<"KEYID123456">> | ||
8> Token = apns:generate_token(TeamId, KeyID). | ||
|
||
=INFO REPORT==== 3-Feb-2017::13:15:34 === |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This info report should be prettified… or removed entirely
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vote for removing it
README.md
Outdated
|
||
## Close connections | ||
|
||
Apple recommends us to keep our connections open and avoiding open and close very often. You can check the [Best Practices for Managing Connections](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) section. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and avoiding open and close -> and avoid opening and closing
README.md
Outdated
|
||
Apple recommends us to keep our connections open and avoiding open and close very often. You can check the [Best Practices for Managing Connections](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) section. | ||
|
||
But when to close a connection makes sense `apns4erl` gives us the function `apns:close_connection/1` where the parameter is the connection's name. After using it the name will be available for new connections again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to close -> closing
[close #136]