push

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

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,
) (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,
) (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 GCMPusher

type GCMPusher struct {
	APIKey string
}

GCMPusher sends push notifications via GCM.

func (*GCMPusher) Send

func (p *GCMPusher) 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 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