Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bergusman authored Jul 5, 2021
1 parent b0ddd17 commit 70d5fd8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
# APNs Provider

HTTP/2 Apple Push Notification service (APNs) provider for Go with token-based connection

Example:

```Go
key, err := apns.AuthKeyFromFile("AuthKey_XXXXXXXXXX.p8")
if err != nil {
log.Fatal(err)
}

token := apns.NewToken(key, "XXXXXXXXXX", "XXXXXXXXXX")
client := apns.NewClient(token, nil)

n := &apns.Notification{
DeviceToken: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
Host: apns.HostDevelopment,
Topic: "com.example.app",
Payload: apns.BuildPayload(&apns.APS{
Alert: "Hi",
}, nil),
}

fmt.Println(client.Push(n))
```

0 comments on commit 70d5fd8

Please sign in to comment.