Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dpup/gohubbub

A PubSubHubbub subscriber client library for Go
https://github.com/dpup/gohubbub

Last synced: 9 days ago
JSON representation

A PubSubHubbub subscriber client library for Go

Awesome Lists containing this project

README

        

GoHubbub
========

A [PubSubHubbub](https://pubsubhubbub.googlecode.com/) 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:

```go
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:

```go
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](./example/example.go) for a fully functioning example.
You will need to run it from a machine that is publicly accessible or use
[reverse port forwarding](https://medium.com/dev-tricks/220030f3c84a) from one
that is.

Contributing
------------
Questions, comments, bug reports, and pull requests are all welcome. Submit
them [on the project issue tracker](https://github.com/dpup/gohubbub/issues/new).

License
-------
Copyright 2014 [Daniel Pupius](http://pupius.co.uk). Licensed under the
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).