push

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: Apache-2.0 Imports: 25 Imported by: 20

Documentation

Index

Constants

View Source
const EmptyMapper = emptyMapper(0)

EmptyMapper is a Mapper which always returns a empty map.

Variables

This section is empty.

Functions

This section is empty.

Types

type APNSPusher

type APNSPusher interface {
	Sender

	Start()
	Stop()
	// contains filtered or unexported methods
}

APNSPusher defines an interface of APNS Pusher

func NewCertBasedAPNSPusher added in v0.21.0

func NewCertBasedAPNSPusher(
	connOpener func() (skydb.Conn, error),
	gatewayType GatewayType,
	cert string,
	key string,
	keepalive int,
) (APNSPusher, error)

NewCertBasedAPNSPusher returns a new APNSPusher from content of certificate and private key as string

func NewTokenBasedAPNSPusher added in v0.21.0

func NewTokenBasedAPNSPusher(
	connOpener func() (skydb.Conn, error),
	gatewayType GatewayType,
	teamID string,
	keyID string,
	key string,
	keepalive int,
) (APNSPusher, error)

NewTokenBasedAPNSPusher creates a new APNSPusher from the content of auth key

type BaiduAndroidPushMessage added in v1.4.0

type BaiduAndroidPushMessage struct {
	Msg        baidu.AndroidNotificationMsg `json:"msg"`
	MsgExpires int                          `json:"msg_expires"`
}

type BaiduPusher added in v1.4.0

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

func NewBaiduPusher added in v1.4.0

func NewBaiduPusher(apiKey string, secretKey string) *BaiduPusher

func (*BaiduPusher) Send added in v1.4.0

func (p *BaiduPusher) Send(m Mapper, device skydb.Device) error

type FCMPusher added in v0.25.0

type FCMPusher struct {
	ServiceAccountKey string
	// contains filtered or unexported fields
}

FCMPusher sends push notifications via FCM.

func NewFCMPusher added in v1.7.0

func NewFCMPusher(connOpener func() (skydb.Conn, error), serviceAccountKey string) (*FCMPusher, error)

func (*FCMPusher) Send added in v0.25.0

func (p *FCMPusher) Send(m Mapper, device skydb.Device) error

Send sends the dictionary represented by m to device.

type GatewayType

type GatewayType string

GatewayType determine which kind of gateway should be used for APNS

const (
	Sandbox    GatewayType = "sandbox"
	Production GatewayType = "production"
)

Available gateways

type LegacyFCMPusher added in v0.25.0

type LegacyFCMPusher struct {
	APIKey string
}

LegacyFCMPusher sends push notifications via GCM.

func (*LegacyFCMPusher) Send added in v0.25.0

func (p *LegacyFCMPusher) Send(m Mapper, device skydb.Device) error

Send sends the dictionary represented by m to device.

type MapMapper

type MapMapper map[string]interface{}

MapMapper is a string-interface map that implemented the Mapper interface.

func (MapMapper) Map

func (m MapMapper) Map() map[string]interface{}

Map returns the map itself.

type Mapper

type Mapper interface {
	// Implementor of Map should return a string-interface map which
	// all values are JSON-marshallable
	Map() map[string]interface{}
}

Mapper defines a single method Map()

type RouteSender

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

RouteSender routes notifications to registered senders that is capable of sending them. RouteSender itself doesn't send notifications.

func NewRouteSender

func NewRouteSender() RouteSender

NewRouteSender return a new RouteSender.

func (RouteSender) Len

func (s RouteSender) Len() int

Len returns the number of services registered with sender.

func (RouteSender) Route

func (s RouteSender) Route(service string, sender Sender)

Route registers a sender to handle notifications sent via a certain Push Notification Service.

func (RouteSender) Send

func (s RouteSender) Send(m Mapper, device skydb.Device) error

Send inspects device and route notification (m) to corresponding sender.

type Sender

type Sender interface {
	Send(m Mapper, device skydb.Device) error
}

Sender defines the methods that a push service should support.

Jump to

Keyboard shortcuts

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