backend

package
v0.0.0-...-a88e025 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2014 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GcmDefaultMaxHttpConns       = 5
	GcmDefaultMaxSleepBeforeFail = 8 * time.Second
)
View Source
const (
	Version = 0
)

Variables

View Source
var (
	ErrUserNotExisting = errors.New("User does not exist")
	ErrUserExists      = errors.New("User already exists")
)
View Source
var (
	GcmAlreadyExistent      = errors.New("The given Registration ID is already present in the database")
	GcmAuthError            = errors.New("The given GCM authkey is invalid. Check it twice.")
	GcmInternalServerError  = errors.New("Internal server error.")
	GcmMessageTooLargeError = errors.New("Message is bigger than 4 KiBs (4096 bytes)")
	GcmTimeoutError         = errors.New("Timeout or server unavailable.")
	GcmUnknownStatusError   = errors.New("Unknown status. Fatal.")
	GcmWontTryAgain         = errors.New("Connector has given up with message delivery")
)

Functions

func AddUser

func AddUser(id int64) error

func CloseDb

func CloseDb() error

func ConnectDb

func ConnectDb(connstr string) (e error)

func DelUser

func DelUser(id int64) error

func Exists

func Exists(id int64) (bool, error)

func ExistsConnector

func ExistsConnector(name string) bool

func InitDb

func InitDb(connstr string) error

func InitGcm

func InitGcm(config *GcmConfig) error

func PushAll

func PushAll(user int64, message Message) (failures bool, errors map[string]error)

Types

type Connector

type Connector interface {
	Exists(deviceTargetId string) (bool, error)
	Push(user int64, message Message) error
	Register(user int64, deviceTargetId string) error
	Subscribed(user int64) (bool, error)
	Unregister(deviceTargetId string) error
}
var (
	ErrNotRegistered = errors.New("Not registered to this connector")
	Gcm              Connector
)

func GetConnector

func GetConnector(name string) Connector

type GcmConfig

type GcmConfig struct {
	ApiKey       string
	MaxTcpConns  int
	MaxRetryTime time.Duration
}

type Message

type Message map[string]string

Jump to

Keyboard shortcuts

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