Documentation
¶
Index ¶
Constants ¶
const (
// FcmEndpoint is the endpoint for sending messages to the FCM server.
FcmEndpoint = "https://fcm.googleapis.com/fcm/send"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct {
RegistrationIDs []string `json:"registration_ids"`
CollapseKey string `json:"collapse_key,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
DelayWhileIdle bool `json:"delay_while_idle,omitempty"`
TimeToLive int `json:"time_to_live,omitempty"`
RestrictedPackageName string `json:"restricted_package_name,omitempty"`
DryRun bool `json:"dry_run,omitempty"`
Notification Notification `json:"notification"`
// contains filtered or unexported fields
}
Message is used by the application server to send a message to the FCM server. See the documentation for FCM Architectural Overview for more information: https://firebase.google.com/docs/cloud-messaging/http-server-ref
func NewMessage ¶
NewMessage returns a new Message with the specified payload and registration IDs. @DEPRECATED as no validation here and client should create itself freely
func (*Message) WithContext ¶
WithContext attach context to message
type Notification ¶
type Response ¶
type Response struct {
MulticastID int64 `json:"multicast_id"`
Success int `json:"success"`
Failure int `json:"failure"`
CanonicalIDs int `json:"canonical_ids"`
Results []Result `json:"results"`
}
Response represents the FCM server's response to the application server's sent message. See the documentation for FCM Architectural
type Result ¶
type Result struct {
MessageID string `json:"message_id"`
RegistrationID string `json:"registration_id"`
Error string `json:"error"`
}
Result represents the status of a processed message.
type Sender ¶
func (*Sender) Send ¶
Send sends a message to the FCM server, retrying in case of service unavailability. A non-nil error is returned if a non-recoverable error occurs (i.e. if the response status is not "200 OK").
Note that messages are retried using exponential backoff, and as a result, this method may block for several seconds.