Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andreas/go-bayeux-client
Go client for Bayeux Protocol
https://github.com/andreas/go-bayeux-client
Last synced: 2 months ago
JSON representation
Go client for Bayeux Protocol
- Host: GitHub
- URL: https://github.com/andreas/go-bayeux-client
- Owner: andreas
- License: mit
- Created: 2015-07-20T09:22:17.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-07-04T08:06:35.000Z (over 2 years ago)
- Last Synced: 2024-06-20T11:09:44.238Z (7 months ago)
- Language: Go
- Size: 8.79 KB
- Stars: 6
- Watchers: 3
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-bayeux-client
This package implements a client conditionally compliant with the [Bayeux Protocol](http://svn.cometd.org/trunk/bayeux/bayeux.html). It uses long-polling, not websockets. Messages are delivered on a channel provided by the user of the library, and can thus be buffered or unbuffered.
Example:
```go
import "github.com/andreas/go-bayeux-client"func main() {
// The second argument is a *http.Client, which defaults to http.DefaultClient.
// This can be used to control timeouts, etc.
client := bayeux.NewClient("https://foo.com", nil)// Messages will be delivered on this channel (use buffered chan if needed).
msgs := make(bayeux.Chan)// Subscribe will automatically handshake with the server if not connected.
if err := client.Subscribe("/bar/baz", msgs); err != nil {
panic(err)
}
// Disconnect from server and stop background loop.
defer client.Close()for msg := range msgs {
fmt.Println("Received message: ", msg)
}
}
```# Limitations
- Does not support publishing.
- Only supports `long-polling` transport/connection type.
- Limited [advice](http://svn.cometd.org/trunk/bayeux/bayeux.html#toc_32) support.