fcm

package
v0.0.0-...-244895d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPrinterID

func GetPrinterID(reader *bufio.Reader) (string, error)

Types

type FCM

type FCM struct {
	FcmSubscribe func(string) (interface{}, error)
	// contains filtered or unexported fields
}

func NewFCM

func NewFCM(clientID string, proxyName string, fcmServerBindURL string, FcmSubscribe func(string) (interface{}, error), notifications chan<- notification.PrinterNotification) (*FCM, error)

func (*FCM) ConnectToFcm

func (f *FCM) ConnectToFcm(fcmNotifications chan<- notification.PrinterNotification, iidToken string, dead chan<- struct{}, quit chan<- struct{}) error

Fcm notification listener

func (*FCM) GetToken

func (f *FCM) GetToken() (string, error)

Returns cached token and Refresh token if needed.

func (*FCM) GetTokenWithRetry

func (f *FCM) GetTokenWithRetry() string

func (*FCM) Init

func (f *FCM) Init()

get token from GCP and connect to FCM.

func (*FCM) KeepFcmAlive

func (f *FCM) KeepFcmAlive()

Restart FCM connection when lost.

func (*FCM) Quit

func (f *FCM) Quit()

Quit terminates the FCM conversation so that new jobs stop arriving.

type FCMMessage

type FCMMessage []struct {
	From        string `json:"from"`
	Category    string `json:"category"`
	CollapseKey string `json:"collapse_key"`
	Data        struct {
		Notification string `json:"notification"`
		Subtype      string `json:"subtype"`
	} `json:"data"`
	MessageID  string `json:"message_id"`
	TimeToLive int    `json:"time_to_live"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL