/gohubbub

A PubSubHubbub subscriber client library for Go

Primary LanguageGoOtherNOASSERTION

GoHubbub

A PubSubHubbub subscriber client library for Go (golang).

For API documentation see https://godoc.org/github.com/dpup/gohubbub

Example

gohubbub can start its own HTTP server:

import "github.com/dpup/gohubbub"

// ...

client := gohubbub.NewClient("mysite.com", "Testing")
client.DiscoverAndSubscribe(topicURL, func(contentType string, body []byte) {
  // Handle update notification.
})
client.StartAndServe("", 80)

Or if you have your own server, you can register the gohubbub request handler on your own mux and then call client.Run() when your server is running:

import "github.com/dpup/gohubbub"

// ...

client := gohubbub.NewClient("mysite.com", "Testing")
client.DiscoverAndSubscribe(topicURL, func(contentType string, body []byte) {
  // Handle update notification.
})
client.RegisterHandler(myMux)

// ...

client.Start()

See this simple program for a fully functioning example. You will need to run it from a machine that is publicly accessible or use reverse port forwarding from one that is.

Contributing

Questions, comments, bug reports, and pull requests are all welcome. Submit them on the project issue tracker.

License

Copyright 2014 Daniel Pupius. Licensed under the Apache License, Version 2.0.