Documentation ¶
Overview ¶
Package gohubbub provides a PubSubHubbub subscriber client. It will request subscriptions from a hub and handle responses as required by the prootcol. Update notifications will be forwarded to the handler function that was registered on subscription.
Index ¶
- type Client
- func (client *Client) Discover(topic string) (string, error)
- func (client *Client) DiscoverAndSubscribe(topic string, handler func(string, []byte)) error
- func (client *Client) HasSubscription(topic string) bool
- func (client *Client) RegisterHandler(mux *http.ServeMux)
- func (client *Client) Start()
- func (client *Client) StartAndServe(addr string, port int)
- func (client Client) String() string
- func (client *Client) Subscribe(hub, topic string, handler func(string, []byte))
- func (client *Client) Unsubscribe(topic string)
- type HttpRequester
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client allows you to register a callback for PubSubHubbub subscriptions, handlers will be executed when an update is received.
func (*Client) Discover ¶
Discover queries an RSS or Atom feed for the hub which it is publishing to.
func (*Client) DiscoverAndSubscribe ¶
DiscoverAndSubscribe queries an RSS or Atom feed for the hub which it is publishing to, then subscribes for updates.
func (*Client) HasSubscription ¶
HasSubscription returns true if a subscription exists for the topic.
func (*Client) RegisterHandler ¶
RegisterHandler binds the client's HandlerFunc to the provided MUX on the path /push-callback/
func (*Client) Start ¶
func (client *Client) Start()
Start makes the initial subscription requests and marks the client as running. Before calling, RegisterHandler should be called with a running server.
func (*Client) StartAndServe ¶
StartAndServe starts a server using DefaultServeMux, and makes initial subscription requests.
func (*Client) Subscribe ¶
Subscribe adds a handler will be called when an update notification is received. If a handler already exists for the given topic it will be overridden.
func (*Client) Unsubscribe ¶
Unsubscribe sends an unsubscribe notification and removes the subscription.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
example
A very simple PubSubHubbub subscriber client that watches a feed that can be easily updated by visiting http://push-pub.appspot.com/.
|
A very simple PubSubHubbub subscriber client that watches a feed that can be easily updated by visiting http://push-pub.appspot.com/. |
medium
A PubSubHubbub subscriber client that watches Medium's latest feed.
|
A PubSubHubbub subscriber client that watches Medium's latest feed. |