session

package
v0.0.0-...-2fed64a Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: GPL-3.0, GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package session handles the minutiae of interacting with the Ubuntu Push Notifications server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSession

func NewSession(serverAddrSpec string, conf ClientSessionConfig,
	deviceId string, seenStateFactory func() (seenstate.SeenState, error),
	log logger.Logger) (*clientSession, error)

Types

type AddressedNotification

type AddressedNotification struct {
	To           *click.AppId
	Notification *protocol.Notification
}

AddressedNotification carries both a protocol.Notification and a parsed AppId addressee.

type AddresseeChecking

type AddresseeChecking interface {
	StartAddresseeBatch()
	CheckForAddressee(*protocol.Notification) *click.AppId
}

AddresseeChecking can check if a notification can be delivered.

type BroadcastNotification

type BroadcastNotification struct {
	TopLevel int64
	Decoded  []map[string]interface{}
}

type ClientSession

type ClientSession interface {
	ResetCookie()
	State() ClientSessionState
	HasConnectivity(bool)
	KeepConnection() error
	StopKeepConnection()
}

ClientSession holds a client<->server session and its configuration.

type ClientSessionConfig

type ClientSessionConfig struct {
	ConnectTimeout         time.Duration
	ExchangeTimeout        time.Duration
	HostsCachingExpiryTime time.Duration
	ExpectAllRepairedTime  time.Duration
	PEM                    []byte
	Info                   map[string]interface{}
	AddresseeChecker       AddresseeChecking
	BroadcastCh            chan *BroadcastNotification
	NotificationsCh        chan AddressedNotification
}

ClientSessionConfig groups the client session configuration.

type ClientSessionState

type ClientSessionState uint32

ClientSessionState is a way to broadly track the progress of the session

const (
	Error ClientSessionState = iota
	Pristine
	Disconnected
	Connected
	Started
	Running
	Shutdown
	Unknown
)

func (ClientSessionState) String

func (s ClientSessionState) String() string

Directories

Path Synopsis
Package seenstate holds implementations of the SeenState that the client session uses to keep track of what messages it has seen.
Package seenstate holds implementations of the SeenState that the client session uses to keep track of what messages it has seen.

Jump to

Keyboard shortcuts

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