Documentation ¶
Index ¶
- type Link
- type Subscriber
- type Subscribers
- type Subscription
- type WebSub
- func (ws *WebSub) AddSubscriber(subscriber *Subscriber)
- func (ws *WebSub) DebugEndpoint(w http.ResponseWriter, r *http.Request)
- func (ws *WebSub) DelSubscriber(topic string, idx int)
- func (ws *WebSub) GetHubEndpoint(target *url.URL) (hubEndpoint *url.URL, selfURL *url.URL, err error)
- func (ws *WebSub) GetSubscriberFor(topic, callback string) (*Subscriber, int)
- func (ws *WebSub) GetSubscription(topic string) *Subscription
- func (ws *WebSub) HasSubscriberFor(topic, callback string) bool
- func (ws *WebSub) IsSubscribed(topic string) bool
- func (ws *WebSub) Load() error
- func (ws *WebSub) NotifyEndpoint(w http.ResponseWriter, r *http.Request)
- func (ws *WebSub) Save() error
- func (ws *WebSub) SendNotification(topic string)
- func (ws *WebSub) Stats() (stats WebSubStats)
- func (ws *WebSub) Subscribe(uri, callback string) error
- func (ws *WebSub) WebSubEndpoint(w http.ResponseWriter, r *http.Request)
- type WebSubStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Link ¶
func GetHeaderLinks ¶
type Subscriber ¶
type Subscriber struct { Topic string `json:"topic"` Callback string `json:"callback"` Verified bool `json:"verified"` CreatedAt time.Time `json:"created_at"` ExpiresAt time.Time `json:"expires_at"` }
func NewSubscriber ¶
func NewSubscriber(topic, callback string) *Subscriber
func (*Subscriber) Expired ¶
func (s *Subscriber) Expired() bool
type Subscribers ¶
type Subscribers []*Subscriber
func (Subscribers) Len ¶
func (s Subscribers) Len() int
func (Subscribers) Less ¶
func (s Subscribers) Less(i, j int) bool
func (Subscribers) Swap ¶
func (s Subscribers) Swap(i, j int)
type Subscription ¶
func NewSubscription ¶
func NewSubscription(topic string) *Subscription
func (*Subscription) Confirm ¶
func (s *Subscription) Confirm(leaseSeconds int)
func (*Subscription) Confirmed ¶
func (s *Subscription) Confirmed() bool
func (*Subscription) Expired ¶
func (s *Subscription) Expired() bool
func (*Subscription) MarshalJSON ¶
func (s *Subscription) MarshalJSON() ([]byte, error)
func (*Subscription) UnmarshalJSON ¶
func (s *Subscription) UnmarshalJSON(data []byte) error
type WebSub ¶
type WebSub struct { sync.RWMutex // Notify is the callback called when processing inbound notifications requests // from a hub we're subscribed to as a client for a given topic Notify func(topic string) error // ValidateTopic is a function that takes a `topic` string as input and returns `true` if it is // a valid topic or `false` otherwise. Consumers should override this field with a custom // topic validation function that suits the application. ValidateTopic func(topic string) bool // contains filtered or unexported fields }
func (*WebSub) AddSubscriber ¶
func (ws *WebSub) AddSubscriber(subscriber *Subscriber)
func (*WebSub) DebugEndpoint ¶
func (ws *WebSub) DebugEndpoint(w http.ResponseWriter, r *http.Request)
func (*WebSub) DelSubscriber ¶
func (*WebSub) GetHubEndpoint ¶
func (*WebSub) GetSubscriberFor ¶
func (ws *WebSub) GetSubscriberFor(topic, callback string) (*Subscriber, int)
func (*WebSub) GetSubscription ¶
func (ws *WebSub) GetSubscription(topic string) *Subscription
func (*WebSub) HasSubscriberFor ¶
func (*WebSub) IsSubscribed ¶
func (*WebSub) NotifyEndpoint ¶
func (ws *WebSub) NotifyEndpoint(w http.ResponseWriter, r *http.Request)
func (*WebSub) SendNotification ¶
func (*WebSub) Stats ¶
func (ws *WebSub) Stats() (stats WebSubStats)
func (*WebSub) WebSubEndpoint ¶
func (ws *WebSub) WebSubEndpoint(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.