chat: github.com/tinode/chat/server/push/fcm Index | Files

package fcm

import "github.com/tinode/chat/server/push/fcm"

Package fcm implements push notification plugin for Google FCM backend. Push notifications for Android, iOS and web clients are sent through Google's Firebase Cloud Messaging service. Package fcm is push notification plugin using Google FCM. https://firebase.google.com/docs/cloud-messaging

Index

Package Files

payload.go push_fcm.go

type AndroidConfig Uses

type AndroidConfig struct {
    Enabled bool `json:"enabled,omitempty"`

    // Configs for specific push types.
    Msg androidPayload `json:"msg,omitempty"`
    Sub androidPayload `json:"msg,omitempty"`
    // contains filtered or unexported fields
}

AndroidConfig is the configuration of AndroidNotification payload.

type Handler Uses

type Handler struct {
    // contains filtered or unexported fields
}

Handler represents the push handler; implements push.PushHandler interface.

func (Handler) Init Uses

func (Handler) Init(jsonconf string) error

Init initializes the push handler

func (Handler) IsReady Uses

func (Handler) IsReady() bool

IsReady checks if the push handler has been initialized.

func (Handler) Push Uses

func (Handler) Push() chan<- *push.Receipt

Push returns a channel that the server will use to send messages to. If the adapter blocks, the message will be dropped.

func (Handler) Stop Uses

func (Handler) Stop()

Stop shuts down the handler

type MessageData Uses

type MessageData struct {
    Uid      t.Uid
    DeviceId string
    Message  *fcm.Message
}

MessageData adds user ID and device token to push message. This is needed for error handling.

func PrepareNotifications Uses

func PrepareNotifications(rcpt *push.Receipt, config *AndroidConfig) []MessageData

PrepareNotifications creates notification payloads ready to be posted to push notification server for the provided receipt.

Package fcm imports 14 packages (graph) and is imported by 5 packages. Updated 2020-05-26. Refresh now. Tools for package owners.