Categorygithub.com/sigmavirus24/gobayeux/v2
modulepackage
2.5.0
Repository: https://github.com/sigmavirus24/gobayeux.git
Documentation: pkg.go.dev

# README

gobayeux

PkgGoDev Test Build Lint

Bayeux protocol library compatible with CometD and Faye servers.

Documentation

Installation

go get github.com/sigmavirus24/gobayeux/v2

Status

Library provides a basic set of features to start getting notification over long-polling transport.

Protocol compliance

  • Handshake
  • Connect/Disconnect
  • Subscribe/Unsubscribe
  • Publish and Delivery event messages
  • The long-polling transport
  • The callback-polling transport
  • The websocket transport

Authors

  • @sigmavirus24
  • @L11R

License

Apache 2.0

# Packages

No description provided by the author

# Functions

NewBayeuxClient initializes a BayeuxClient for the user.
NewClient creates a new high-level client.
NewConnectionStateMachine creates a new ConnectionStateMachine to manage a connection's state.
NewConnectRequestBuilder initializes a ConnectRequestBuilder as an easy way to build a Message that can be sent as a /meta/connect request.
NewDisconnectRequestBuilder initializes a DisconnectRequestBuilder as an easy way to build a Message that can be sent as a /meta/disconnect request.
NewHandshakeRequestBuilder provides an easy way to build a Message that can be sent as a Handshake Request as documented in https://docs.cometd.org/current/reference/#_handshake_request.
NewSubscribeRequestBuilder initializes a SubscribeRequestBuilder as an easy way to build a Message that can be sent as a /meta/subscribe request.
NewUnsubscribeRequestBuilder initializes a SubscribeRequestBuilder as an easy way to build a Message that can be sent as a /meta/subscribe request.
WithFieldLogger returns an Option with logger.
WithHTTPClient returns an Option with custom http.Client.
WithHTTPTransport returns an Option with custom http.RoundTripper.
WithIgnoreError takes a function that will be called whenever an error is returned while subscribing or unsubscribing.
WithLogger returns an Option with logger.
No description provided by the author

# Constants

BroadcastChannel represents all other channels.
ConnectionTypeCallbackPolling is a constant for the callback-polling string.
ConnectionTypeIFrame is a constant for the iframe string.
ConnectionTypeLongPolling is a constant for the long-polling string.
ErrBadChannel is returned when the handshake response is on the wrong channel.
ErrClientNotConnected is returned when the client is not connected.
ErrFailedToConnect is a general connection error.
ErrMissingClientID is returned when the client id has not been set.
ErrMissingConnectionType is returned when the connection type is unset.
ErrNoSupportedConnectionTypes is returned when the client and server aren't able to agree on a connection type.
ErrNoVersion is returned when a version is not provided.
ErrTooManyMessages is returned when there is more than one handshake message.
MetaChannel represents the `/meta/` channel type.
MetaConnect is the Channel used for connect messages after a successful handshake.
MetaDisconnect is the Channel used for disconnect messages.
MetaHandshake is the Channel for the first message a new client sends.
MetaSubscribe is the Channel used by a client to subscribe to channels.
MetaUnsubscribe is the Channel used by a client to unsubscribe to channels.
ServiceChannel represents the `/service/` channel type.

# Structs

ActionFailedError is a general purpose error returned by the BayeuxClient.
Advice represents the field from the server which is used to inform clients of their preferred mode of client operation.
AlreadyRegisteredError signifies that the given MessageExtender is already registered with the client.
BadConnectionError is returned when trying to connected but not connecting.
BadConnectionTypeError is returned when we don't know how to handle the requested connection type.
BadConnectionVersionError is returned when we can't support the requested version number.
BadHandshakeError is returned when trying to handshake but not unconnected.
BadResponseError is returned when we get an unexpected HTTP response from the server.
BadStateError is returned when the state machine transition is not valid.
BayeuxClient is a way of acting as a client with a given Bayeux server.
Client is a high-level abstraction.
ConnectionFailedError is returned whenever Connect is called and it fails.
ConnectionStateMachine handles managing the connection's state See also: https://docs.cometd.org/current/reference/#_client_state_table.
ConnectRequestBuilder provides a way to safely build a Message that can be sent as a /meta/connect request as documented in https://docs.cometd.org/current/reference/#_connect_request.
DisconnectFailedError is returned when the call to Disconnect fails.
DisconnectRequestBuilder provides an easy way to build a /meta/disconnect request per the specification in https://docs.cometd.org/current/reference/#_bayeux_meta_disconnect.
HandshakeFailedError is returned whenever the handshake fails.
HandshakeRequestBuilder provides a way to safely and confidently create handshake requests to /meta/handshake.
InvalidChannelError is the result of a failure to validate a channel name.
Message represents a message received by a Bayeux client See also: https://docs.cometd.org/current/reference/#_bayeux_message_fields.
MessageError represents a parsed Error field of a Message See also: https://docs.cometd.org/current/reference/#_error.
Options stores the available configuration options for a Client.
SubscribeRequestBuilder provides an easy way to build a /meta/subscribe request per the specification in https://docs.cometd.org/current/reference/#_subscribe_request.
SubscriptionFailedError is returned for any errors on Subscribe.
UnknownEventTypeError is returned when the next state is unknown.
UnsubscribeFailedError is returned for any errors on Unsubscribe.
UnsubscribeRequestBuilder provides an easy way to build a /meta/unsubscribe request per the specification in https://docs.cometd.org/current/reference/#_unsubscribe_request.

# Interfaces

Logger defines the logging interface gobayeux leverages.
MessageExtender defines the interface that extensions are expected to implement.

# Type aliases

Channel represents a Bayeux Channel which is defined as "a string that looks like a URL path such as `/foo/bar`, `/meta/connect`, or `/service/chat`." See also: https://docs.cometd.org/current/reference/#_concepts_channels.
ChannelType is used to define the three types of channels: - meta channels, channels starting with `/meta/` - service channels, channels starting with `/service/` - broadcast channels, all other channels.
EmptySliceError is returned when an empty slice is unexpected.
ErrMessageUnparsable is returned when we fail to parse a message.
Event represents and event that can change the state of a state machine.
IgnoreErrorFunc is a callback function that inspects an error and determines if it can be safely ignored when subscribing and unsubscribing.
Option defines the type passed into NewClient for configuration.
StateRepresentation represents the current state of a connection as a string.