Documentation ¶
Overview ¶
Package push sends notifications over HTTP/2 to Apple's Push Notification Service.
Index ¶
Constants ¶
View Source
const ( Development = "https://api.development.push.apple.com" Production = "https://api.push.apple.com" )
Apple host locations.
Variables ¶
View Source
var ( ErrPayloadEmpty = errors.New("the message payload was empty") ErrPayloadTooLarge = errors.New("the message payload was too large") ErrMissingDeviceToken = errors.New("device token was not specified") ErrBadDeviceToken = errors.New("bad device token") ErrTooManyRequests = errors.New("too many requests were made consecutively to the same device token") ErrBadMessageID = errors.New("the ID header value is bad") ErrBadExpirationDate = errors.New("the Expiration header value is bad") ErrBadPriority = errors.New("the apns-priority value is bad") ErrBadTopic = errors.New("the Topic header was invalid") ErrBadCertificate = errors.New("the certificate was bad") ErrBadCertificateEnvironment = errors.New("certificate was for the wrong environment") ErrForbidden = errors.New("there was an error with the certificate") ErrMissingTopic = errors.New("the Topic header of the request was not specified and was required") ErrTopicDisallowed = errors.New("pushing to this topic is not allowed") ErrUnregistered = errors.New("device token is inactive for the specified topic") ErrDeviceTokenNotForTopic = errors.New("device token does not match the specified topic") ErrDuplicateHeaders = errors.New("one or more headers were repeated") ErrBadPath = errors.New("the request contained a bad :path") ErrMethodNotAllowed = errors.New("the specified :method was not POST") ErrIdleTimeout = errors.New("idle time out") ErrShutdown = errors.New("the server is shutting down") ErrInternalServerError = errors.New("an internal server error occurred") ErrBadRequest = errors.New("bad request") ErrUnknown = errors.New("unknown error") )
Service error responses.
Functions ¶
func IsDeviceTokenValid ¶ added in v0.3.0
IsDeviceTokenValid checks if s is a hexadecimal token of the correct length.
Types ¶
type Headers ¶
type Headers struct { // ID for the notification. Apple generates one if ommitted. // This should be a UUID with 32 lowercase hexadecimal digits. // TODO: use a UUID type. ID string // Apple will retry delivery until this time. The default behavior only tries once. Expiration time.Time // Allow Apple to group messages to together to reduce power consumption. // By default messages are sent immediately. LowPriority bool // Topic for certificates with multiple topics. Topic string }
Headers sent with a push to control the notification (optional)
Click to show internal directories.
Click to hide internal directories.