Documentation ¶
Overview ¶
Package push provides GCM and APN push notification functionality.
Index ¶
Constants ¶
View Source
const ( // ApnsEndpointSandbox is the endpoint of the sandbox APNS service. ApnsEndpointSandbox = "gateway.sandbox.push.apple.com" // ApnsEndpointProduction is the endpoint of the production APNS service. ApnsEndpointProduction = "gateway.push.apple.com" // ApnsPort is the port of the APNS service. ApnsPort = 2195 // IosDefaultSound is the name of the default sound to play for iOS notifications. IosDefaultSound = "default" )
View Source
const (
// MaxRetries defines the number of times to retry message sender if an error occurs.
MaxRetries = 2
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AndroidPusher ¶
type AndroidPusher struct {
// contains filtered or unexported fields
}
AndroidPusher supports sending of GCM push notifications to Android devices.
func NewAndroidPusher ¶
func NewAndroidPusher(apiKey string) *AndroidPusher
NewAndroidPusher returns an AndroidPusher, initialized with the specified GCM API key.
func (*AndroidPusher) SendMessage ¶
func (a *AndroidPusher) SendMessage(message *Message, deviceIds ...string) error
SendMessage sends a JSON payload to the specified DeviceIds through the GCM service.
type IosPusher ¶
type IosPusher struct {
// contains filtered or unexported fields
}
IosPusher supports sending of APNS push notifications to iOS devices.
func NewIosPusher ¶
NewIosPusher returns an IosPusher, initialized with the specified certificate and key files.
type Message ¶
type Message struct { // Content is the title or content to be displayed to the user. Content string // Data contains any additional data to be sent with the notification. Data map[string]interface{} // IosSound is the sound to play for iOS devices specifically. IosSound string }
Message defines a push message payload to be send to the client.
Click to show internal directories.
Click to hide internal directories.