Documentation
¶
Index ¶
- Variables
- func ValidateSignature(body []byte, secret, signature string) bool
- type Client
- func (c *Client) Discover(topicURL string) (string, string, error)
- func (c *Client) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (c *Client) Subscribe(opts SubscribeOptions) (*model.Subscription, error)
- func (c *Client) Unsubscribe(opts UnsubscribeOptions) error
- func (c *Client) VerifySubscription(mode, topic, requestUrl string, v url.Values) ([]byte, error)
- type Option
- type Publish
- type SubscribeOptions
- type SubscriptionDenied
- type UnsubscribeOptions
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ValidateSignature ¶
ValidateSignature is a helper method to validate a signature a hub sends.
Types ¶
type Client ¶
Client represents a websub client
func (*Client) ServeHTTP ¶
func (c *Client) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP lets this client be used as a handler for HTTP servers.
func (*Client) Subscribe ¶
func (c *Client) Subscribe(opts SubscribeOptions) (*model.Subscription, error)
Subscribe creates a new websub request
func (*Client) Unsubscribe ¶
func (c *Client) Unsubscribe(opts UnsubscribeOptions) error
Unsubscribe sends an unsubscription request to the hub
type Option ¶
type Option func(c *Client)
Option is an option type for definition client options
func WithCallbackBase ¶
WithCallbackBase sets the base callback url
func WithHttpClient ¶
WithHttpClient lets you override the client's http client
func WithLeaseDuration ¶
WithLeaseDuration lets you override the default lease duration request
type Publish ¶
type Publish struct { Subscription model.Subscription ContentType string Data []byte }
Publish is called when items are published
type SubscribeOptions ¶
type SubscribeOptions struct { Hub string Topic string Callback string Secret string Lease time.Duration }
SubscribeOptions are options sent to the hub for subscriptions
type SubscriptionDenied ¶
type SubscriptionDenied struct { Subscription *model.Subscription Reason string }
type UnsubscribeOptions ¶ added in v0.2.0
UnsubscribeOptions allows the use of a custom Hub for unsubscribes. This used to be UnsubscribeRequest from the base model, but was changed for simplicity.