Version: v0.13.1 Latest Latest

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

Go to latest
Published: Nov 28, 2017 License: GPL-3.0 Imports: 4 Imported by: 3




This section is empty.


This section is empty.


func Init

func Init(jsconfig string) error

Initialize registered handlers

func Push

func Push(msg *Receipt)

Push a single message

func Register

func Register(name string, hnd PushHandler)

Register a push handler

func Stop

func Stop()

Stop all pushes


type Payload

type Payload struct {
	Topic string `json:"topic"`
	// Google is retarded. "from" is a reserved keyword in FCM
	From      string    `json:"xfrom"`
	Timestamp time.Time `json:"ts"`
	SeqId     int       `json:"seq"`
	// Actual Data.Content of the message, if requested
	Content interface{} `json:"content,omitempty"`

type PushHandler

type PushHandler interface {
	// Initialize the handler
	Init(jsonconf string) error

	// Check if the handler is initialized
	IsReady() bool

	// Push returns a channel that the server will use to send messages to.
	// The message will be dropped if the channel blocks.
	Push() chan<- *Receipt

	// Stop operations

PushHandler is an interface which must be implemented by handlers.

type PushTo

type PushTo struct {
	// Addresse
	User t.Uid `json:"user"`
	// Count of user's connections that were live when the packet was dispatched from the server
	Delieved int `json:"delivered"`
	// List of user's devices that the packet was delivered to (if known). Len(Devices) >= Delivered
	Devices []string `json:"devices,omitempty"`

type Receipt

type Receipt struct {
	// List of recepients, including those who did not receive the message
	To []PushTo `json:"to"`
	// Actual content to be delivered to the client
	Payload Payload `json:"payload"`

Source Files

Jump to

Keyboard shortcuts

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