Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
apns2
✓ github.com/sideshow/apns2
Sends a push notification to an iOS device via APNs.
package main
import (
"log"
"github.com/sideshow/apns2"
"github.com/sideshow/apns2/certificate"
)
func main() {
cert, _ := certificate.FromP12File("cert.p12", "")
client := apns2.NewClient(cert).Production()
notification := &apns2.Notification{
DeviceToken: "device-token",
Payload: []byte(`{"aps":{"alert":"Hello!"}}`),
}
res, err := client.Push(notification)
if err != nil {
log.Fatal(err)
}
log.Printf("APNs response: %v", res)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
0.25.0latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.