subscriptions

package module
v0.0.0-...-8f6edbe Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeDirect    = "Direct"
	ModeWebsocket = "Websocket"
)
View Source
const (
	StateInit      = "Init"
	StateReady     = "Ready"
	StateTestNotif = "TestNotif"
	StateExpired   = "Expired"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpiredSubscriptionCb

type ExpiredSubscriptionCb func(*Subscription)

type NewWebsocketCb

type NewWebsocketCb func(*Subscription) (string, error)

type PeriodicSubscriptionCb

type PeriodicSubscriptionCb func(*Subscription)

type Subscription

type Subscription struct {
	Cfg             *SubscriptionCfg
	JsonSubOrig     string       `json:"jsonSubOrig"`
	Mode            string       `json:"mode"`
	State           string       `json:"state"`
	PeriodicCounter int32        `json:"periodicCounter"`
	TestNotifSent   bool         `json:"testNotifSent"`
	WsCreated       bool         `json:"wsCreated"`
	HttpClient      *http.Client `json:"-"`
	Ws              *ws.Websocket
	WsTransport     *ws.Transport3gppWsNotif `json:"-"`
}

type SubscriptionCfg

type SubscriptionCfg struct {
	Id                  string     `json:"id"`
	AppId               string     `json:"appId"`
	Type                string     `json:"subType"`
	NotifType           string     `json:"notifType"`
	Self                string     `json:"self"`
	NotifyUrl           string     `json:"notifyUrl"`
	ExpiryTime          *time.Time `json:"expiryTime"`
	PeriodicInterval    int32      `json:"periodicInterval"`
	RequestTestNotif    bool       `json:"reqTestNotif"`
	RequestWebsocketUri bool       `json:"reqWebsockUri"`
}

type SubscriptionMgr

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

func NewSubscriptionMgr

func NewSubscriptionMgr(cfg *SubscriptionMgrCfg, addr string) (sm *SubscriptionMgr, err error)

NewSubscriptionMgr - Create and initialize a Subscription Manager instance

func (*SubscriptionMgr) CreateSubscription

func (sm *SubscriptionMgr) CreateSubscription(cfg *SubscriptionCfg, jsonSubOrig string) (*Subscription, error)

func (*SubscriptionMgr) DeleteAllSubscriptions

func (sm *SubscriptionMgr) DeleteAllSubscriptions() error

func (*SubscriptionMgr) DeleteFilteredSubscriptions

func (sm *SubscriptionMgr) DeleteFilteredSubscriptions(AppId string, Type string) error

func (*SubscriptionMgr) DeleteSubscription

func (sm *SubscriptionMgr) DeleteSubscription(sub *Subscription) error

func (*SubscriptionMgr) GenerateSubscriptionId

func (sm *SubscriptionMgr) GenerateSubscriptionId() string

func (*SubscriptionMgr) GetAllSubscriptions

func (sm *SubscriptionMgr) GetAllSubscriptions() ([]*Subscription, error)

func (*SubscriptionMgr) GetFilteredSubscriptions

func (sm *SubscriptionMgr) GetFilteredSubscriptions(AppId string, Type string) ([]*Subscription, error)

func (*SubscriptionMgr) GetSubscription

func (sm *SubscriptionMgr) GetSubscription(Id string) (*Subscription, error)

func (*SubscriptionMgr) ReadyToSend

func (sm *SubscriptionMgr) ReadyToSend(sub *Subscription) bool

func (*SubscriptionMgr) SendNotification

func (sm *SubscriptionMgr) SendNotification(sub *Subscription, notif []byte) error

func (*SubscriptionMgr) SetSubscriptionJson

func (sm *SubscriptionMgr) SetSubscriptionJson(sub *Subscription, jsonSub string) error

func (*SubscriptionMgr) UpdateSubscription

func (sm *SubscriptionMgr) UpdateSubscription(sub *Subscription) error

type SubscriptionMgrCfg

type SubscriptionMgrCfg struct {
	Module         string
	Sandbox        string
	Mep            string
	Service        string
	Basekey        string
	MetricsEnabled bool
	ExpiredSubCb   ExpiredSubscriptionCb
	PeriodicSubCb  PeriodicSubscriptionCb
	TestNotifCb    TestNotificationCb
	NewWsCb        NewWebsocketCb
}

type TestNotificationCb

type TestNotificationCb func(*Subscription) error

Jump to

Keyboard shortcuts

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