Documentation
¶
Overview ¶
Package mobile provides a push notification sending interface with implementations for APNs and FCM.
This package was duplicated from the notifications package to allow independent evolution. The notifications package is deprecated; new code should use mobile.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPlatformNotSupported = errors.New("push notifications not configured for this platform")
ErrPlatformNotSupported is returned when attempting to send to a platform that has no configured sender (e.g., iOS token but APNs not configured).
Functions ¶
This section is empty.
Types ¶
type MobileNotificationRequest ¶
type MobileNotificationRequest struct {
Context map[string]string `json:"context,omitempty"`
BadgeCount *int `json:"badgeCount,omitempty"`
RequestType string `json:"requestType"`
Title string `json:"title"`
Body string `json:"body"`
TestID string `json:"testID,omitempty"`
RecipientUserIDs []string `json:"recipientUserIDs"`
}
MobileNotificationRequest is the generic message payload for mobile push notifications. RequestType determines which handler processes the request; schedulers format the message.
type MultiPlatformPushSender ¶
type MultiPlatformPushSender struct {
// contains filtered or unexported fields
}
MultiPlatformPushSender routes push notifications to APNs (iOS) or FCM (Android).
func NewMultiPlatformPushSender ¶
func NewMultiPlatformPushSender( apnsSender *apns.Sender, fcmSender *fcm.Sender, logger logging.Logger, tracerProvider tracing.TracerProvider, ) *MultiPlatformPushSender
NewMultiPlatformPushSender creates a sender that routes by platform.
func (*MultiPlatformPushSender) SendPush ¶
func (s *MultiPlatformPushSender) SendPush(ctx context.Context, platform, token string, msg PushMessage) error
SendPush sends a push notification to a single device token, routing by platform.
type PushMessage ¶
PushMessage holds the content of a push notification. BadgeCount is optional; when non-nil on iOS, sets the app icon badge.
type PushNotificationSender ¶
type PushNotificationSender interface {
// SendPush sends a push notification to a single device token.
// platform is "ios" or "android"; implementations filter by platform.
SendPush(ctx context.Context, platform, token string, msg PushMessage) error
}
PushNotificationSender sends push notifications to device tokens. Implementations route by platform: APNs for ios, FCM for android.