Simple apns api (http/2) client for golang.
It provides only client, so should setup http/2 client, apns payload yourself.
token := "..."
client := apnsapi.NewClient(apnsapi.ProductionServer, &http.Client{...})
header := &apnsapi.Header{ApnsTopic: "..."}
payload := `{ "aps" : { "alert" : "hi" } }`
if _, err = client.Do(token, header, []byte{payload}); err != nil {
...
}
_example/main.go
is sample implantation and used like this.
$ go run _example/main.go --p12 /path/to/file.p12 --topic $topic --token $token
$ go run _example/main.go --key /path/to/file.p8 --kid $keyIdentifier --teamId $teamID --topic $topic --token $token
- https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/Introduction.html
- https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html
- https://developer.apple.com/videos/play/wwdc2016/724/
MIT