hiapns

package module
v0.0.0-...-64ef918 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2015 License: GPL-3.0 Imports: 9 Imported by: 0

README

hiapns

Simple APNs worker that pushes notifications for you

build

go build build/hiapns.go

run

./hiapns -c /path/to/conf

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadValue     = errors.New("值不合法")
	ErrNoClient     = errors.New("client 不存在")
	ErrCertMissing  = errors.New("cert 不能为空")
	ErrKeyMissing   = errors.New("key 不能为空")
	ErrAlertMissing = errors.New("alert 不能为空")
	ErrBadAlert     = errors.New("alert 只能是字符串")
	ErrBadBadge     = errors.New("badge 只能是数字")
	ErrBadSound     = errors.New("sound 只能是字符串")
	ErrBadFormat    = errors.New("参数格式不正确")
)

Functions

func FeedWorkerWithNSQ

func FeedWorkerWithNSQ(worker *Worker, nsqTopic, nsqChannel, nsqdAddr string) error

func NotificationFromMsg

func NotificationFromMsg(tok string, msg map[string]interface{}) (*apns.Notification, error)

func PayloadFromMsg

func PayloadFromMsg(msg map[string]interface{}) (*apns.Payload, error)

Types

type Counter

type Counter chan uint32

func NewCounter

func NewCounter() Counter

func (Counter) Next

func (c Counter) Next() uint32

type Hub

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

func NewHub

func NewHub(cfg map[string]map[string]string) *Hub

func NewHubFromCfgFile

func NewHubFromCfgFile(filepath string) (*Hub, error)

func (Hub) Send

func (hb Hub) Send(name string, n *apns.Notification) error

type Request

type Request struct {
	Notif *apns.Notification
	App   string
}

func ParseRequestFromJSON

func ParseRequestFromJSON(bs []byte) (req Request, err error)

sample msg body: {"expire":1438241451, "app": "appname", "token": "token-str", "payload": {"aps":{"alert":"msg","sound":"hi.caf"},"extra":2}}

type Worker

type Worker struct {
	ReqCh chan Request
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(hub *Hub) *Worker

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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