一个用于与 Apple 推送通知服务进行接口的 Go 包
A Go package to interface with the Apple Push Notification Service
This library implements a few features that we couldn't find in any one library elsewhere:
The apns package may undergo breaking changes. A tool like godep is recommended to vendor the current release.
go get github.com/timehop/apnsCheckout the develop branch for the current work in progress.
c, _ := apns.NewClient(apns.ProductionGateway, apnsCert, apnsKey)
p := apns.NewPayload()
p.APS.Alert.Body = "I am a push notification!"
p.APS.Badge.Set(5)
p.APS.Sound = "turn_down_for_what.aiff"
m := apns.NewNotification()
m.Payload = p
m.DeviceToken = "A_DEVICE_TOKEN"
m.Priority = apns.PriorityImmediate
c.Send(m)…f, err := apns.NewFeedback(s.Address(), DummyCert, DummyKey)
if err != nil {
log.Fatal("Could not create feedback", err.Error())
}
for ft := range f.Receive() {
fmt.Println("Feedback for token:", ft.DeviceToken)
}Note that the channel returned from Receive will close after the
feedback service
has no more data to send.
We use Ginkgo for our testing framework and Gomega for our matchers. To run the tests:
go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega
ginkgo -randomizeAllSpecs暂无开放 Issues,或尚未同步最近议题。