bayeux

package
v1.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: MIT Imports: 11 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Adapted from https://github.com/andreas/go-bayeux-client

Index

Constants

View Source
const (
	VERSION         = "1.0"
	MINIMUM_VERSION = "1.0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client allows connecting to a Bayeux server and subscribing to channels.

func NewClient

func NewClient(force *Force) *Client

NewClient initialises a new Bayeux client. By default `http.DefaultClient` is used for HTTP connections.

func (*Client) Close

func (c *Client) Close() error

Close notifies the Bayeux server of the intent to disconnect and terminates the background polling loop.

func (*Client) Connect

func (c *Client) Connect() error

Connect performs a handshake with the server and will repeatedly initiate a long-polling connection until `Close` is called on the client.

func (*Client) Subscribe

func (c *Client) Subscribe(pattern string, out chan<- *Message) error

Subscribe is like `SubscribeExt` with a blank `ext` part.

func (*Client) SubscribeExt

func (c *Client) SubscribeExt(pattern string, out chan<- *Message, ext interface{}) error

SubscribeExt creates a new subscription on the Bayeux server. Messages for the subscription will be delivered on the given channel `out`. If the client has not performed a handshake already, it will do so first.

func (*Client) Unsubscribe

func (c *Client) Unsubscribe(pattern string) error

type Message

type Message struct {
	Channel   string          `json:"channel"`
	Data      json.RawMessage `json:"data,omitempty"`
	Id        string          `json:"id,omitempty"`
	ClientId  string          `json:"clientId,omitempty"`
	Extension interface{}     `json:"ext,omitempty"`
}

Message is the type delivered to subscribers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL