Home
Softono
apns-go

apns-go

Open source MIT Go
17
Stars
1
Forks
0
Issues
1
Watchers
4 years
Last Commit

About apns-go

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

Platforms

Web Self-hosted

Languages

Go

Links

APNs Provider

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

Example:

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

token := apns.NewToken(key, "XXXXXXXXXX", "YYYYYYYYYY")
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))