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 for configuring Service.
Variables ¶
View Source
var ( // These could be checked prior to sending the request to Apple. ErrPayloadEmpty = errors.New("PayloadEmpty") ErrPayloadTooLarge = errors.New("PayloadTooLarge") // Device token errors. ErrMissingDeviceToken = errors.New("MissingDeviceToken") ErrBadDeviceToken = errors.New("BadDeviceToken") ErrTooManyRequests = errors.New("TooManyRequests") // Header errors. ErrBadMessageID = errors.New("BadMessageID") ErrBadExpirationDate = errors.New("BadExpirationDate") ErrBadPriority = errors.New("BadPriority") ErrBadTopic = errors.New("BadTopic") // Certificate and topic errors. ErrBadCertificate = errors.New("BadCertificate") ErrBadCertificateEnvironment = errors.New("BadCertificateEnvironment") ErrForbidden = errors.New("Forbidden") ErrMissingTopic = errors.New("MissingTopic") ErrTopicDisallowed = errors.New("TopicDisallowed") ErrUnregistered = errors.New("Unregistered") ErrDeviceTokenNotForTopic = errors.New("DeviceTokenNotForTopic") // These errors should never happen when using Push. ErrDuplicateHeaders = errors.New("DuplicateHeaders") ErrBadPath = errors.New("BadPath") ErrMethodNotAllowed = errors.New("MethodNotAllowed") // Fatal server errors. ErrIdleTimeout = errors.New("IdleTimeout") ErrShutdown = errors.New("Shutdown") ErrInternalServerError = errors.New("InternalServerError") )
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 omitted. // 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 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)
type Queue ¶ added in v0.7.0
type Queue struct {
// contains filtered or unexported fields
}
Queue up notifications without waiting for the response.
func NewQueue ¶ added in v0.7.0
NewQueue wraps a service with a queue for sending notifications asynchronously.
type Service ¶
Service is the Apple Push Notification Service that you send notifications to.
func NewService ¶ added in v0.5.0
NewService creates a new service to connect to APN.
Click to show internal directories.
Click to hide internal directories.