A PubSubHubbub subscriber client library for Go
Go
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example Differentiate "self" from the address and port the server listens on May 17, 2014
.gitignore
LICENCE.txt Initial implementation of PubSubHubbub subscriber client in Go Feb 2, 2014
README.md
feed.go
gohubbub.go

README.md

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.