Documentation
¶
Overview ¶
Package messaging is a thin wrapper over Firebase Cloud Messaging (FCM). It exposes topic subscription management, single-topic broadcasts, and a dry-run helper for validating large batches of device tokens.
Index ¶
Constants ¶
const (
MaximumTokensPerBatch = 500
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
SkipFirebaseInit bool
Firebase FirebaseConf
}
Config controls how Init builds the messaging client. Setting SkipFirebaseInit short-circuits the live Firebase Cloud Messaging connection — useful for tests.
type FirebaseAccountKey ¶
type FirebaseAccountKey struct {
Type string `json:"type"`
ProjectID string `json:"project_id"`
PrivateKeyID string `json:"private_key_id"`
PrivateKey string `json:"private_key"`
ClientEmail string `json:"client_email"`
ClientID string `json:"client_id"`
AuthURI string `json:"auth_uri"`
TokenURI string `json:"token_uri"`
AuthProviderx509CertURL string `json:"auth_provider_x509_cert_url"`
Clientx509CertURL string `json:"client_x509_cert_url"`
}
type FirebaseConf ¶
type FirebaseConf struct {
AccountKey FirebaseAccountKey
ApiKey string
}
type Interface ¶
type Interface interface {
SubscribeToTopic(ctx context.Context, deviceToken, topic string) error
UnsubscribeFromTopic(ctx context.Context, deviceToken, topic string) error
BroadcastToTopic(ctx context.Context, topic string, payload map[string]string) error
BatchSendDryRun(ctx context.Context, tokens []string) ([]string, error)
}
Interface is the public surface of the messaging package — mockable for tests via the firebaseMessenger seam underneath.
func Init
deprecated
Init builds a messaging client. The httpClient parameter is ignored because the underlying Firebase SDK manages its own HTTP transport.
Deprecated: httpClient is not used and will be removed in v2.0.0. Pass nil for forward-compatibility.