APNS/2 介绍
APNS/2 是一个 Go 语言实现的 Apple Push Notifications on iOS, OSX 和 Safari 开发包,使用全新的
HTTP/2 Push provider API,特点是简单、灵活和快速。
特性:
示例代码:
package main import ( apns "github.com/sideshow/apns2" "github.com/sideshow/apns2/certificate" "log" ) func main() { cert, pemErr := certificate.FromPemFile("../cert.pem", "") if pemErr != nil { log.Println("Cert Error:", pemErr) } notification := &apns.Notification{} notification.Devicetoken = "11aa01229f15f0f0c52029d8cf8cd0aeaf2365fe4cebc4af26cd6d76b7919ef7" notification.Topic = "com.sideshow.Apns2" notification.Payload = []byte(`{"aps":{"alert":"Hello!"}}`) // See Payload section below client := apns.NewClient(cert).Development() res, err := client.Push(notification) if err != nil { log.Println("Error:", err) return } }
APNS/2 官网
https://github.com/sideshow/apns2
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。