Documentation ¶
Index ¶
- Constants
- func NewConfig() *config.Config
- func NewConfigFromCLI(args []string, opts ...cliOption) (*config.Config, error, bool)
- func WithCLICustomOptions(factory customOptionsFactory) cliOption
- func WithCLIName(name string) cliOption
- func WithCLIUsageHeader(desc string) cliOption
- func WithCLIVersion(str string) cliOption
- type Embedded
- type Option
- func WithBroadcasters(fn broadcastersFactory) Option
- func WithBroker(fn brokerFactory) Option
- func WithController(fn controllerFactory) Option
- func WithDefaultBroadcaster() Option
- func WithDefaultBroker() Option
- func WithDefaultRPCController() Option
- func WithDefaultSubscriber() Option
- func WithDisconnector(fn disconnectorFactory) Option
- func WithLogger(logger *slog.Logger) Option
- func WithName(name string) Option
- func WithShutdownable(instance Shutdownable) Option
- func WithSubscriber(fn subscriberFactory) Option
- func WithTelemetry(props ...string) Option
- func WithWebSocketEndpoint(path string, fn websocketHandler) Option
- func WithWebSocketHandler(fn websocketHandler) Option
- type Runner
- type Shutdownable
Constants ¶
const CurrentConfigPath = "./anycable.toml"
const DefaultConfigPath = "/etc/anycable/anycable.toml"
Variables ¶
This section is empty.
Functions ¶
func NewConfig ¶ added in v1.5.0
NewConfig returns a new AnyCable configuration combining default values and values from the environment.
func NewConfigFromCLI ¶ added in v1.2.3
NewConfigFromCLI reads config from os.Args. It returns config, error (if any) and a bool value indicating that the execution was interrupted (e.g., usage message or version was shown), no further action required.
func WithCLICustomOptions ¶ added in v1.3.0
func WithCLICustomOptions(factory customOptionsFactory) cliOption
func WithCLIName ¶ added in v1.3.0
func WithCLIName(name string) cliOption
func WithCLIUsageHeader ¶ added in v1.3.0
func WithCLIUsageHeader(desc string) cliOption
func WithCLIVersion ¶ added in v1.3.0
func WithCLIVersion(str string) cliOption
Types ¶
type Embedded ¶ added in v1.5.0
type Embedded struct {
// contains filtered or unexported fields
}
A minimal interface to the underlying Runner for embedding AnyCable into your own Go HTTP application.
func (*Embedded) HTTPBroadcastHandler ¶ added in v1.5.0
HTTPBroadcastHandler returns an HTTP handler to process broadcasting requests
func (*Embedded) SSEHandler ¶ added in v1.5.0
SSEHandler returns an HTTP handler to serve SSE connections via AnyCable. Please, provide your HTTP server's shutdown context to terminate SSE connections gracefully on server shutdown.
type Option ¶ added in v1.2.3
Option represents a Runner configuration function
func WithBroadcasters ¶ added in v1.4.0
func WithBroadcasters(fn broadcastersFactory) Option
WithBroadcaster is an Option to set Runner broadaster
func WithBroker ¶ added in v1.4.0
func WithBroker(fn brokerFactory) Option
WithBroker is an Option to set Runner broker
func WithController ¶ added in v1.2.3
func WithController(fn controllerFactory) Option
WithController is an Option to set Runner controller
func WithDefaultBroadcaster ¶ added in v1.4.0
func WithDefaultBroadcaster() Option
WithDefaultBroadcaster is an Option to set Runner subscriber to default broadcaster from config
func WithDefaultBroker ¶ added in v1.4.0
func WithDefaultBroker() Option
WithDefaultBroker is an Option to set Runner broker to default broker from config
func WithDefaultRPCController ¶ added in v1.2.3
func WithDefaultRPCController() Option
WithDefaultRPCController is an Option to set Runner controller to default rpc.Controller
func WithDefaultSubscriber ¶ added in v1.2.3
func WithDefaultSubscriber() Option
WithDefaultSubscriber is an Option to set Runner subscriber to pubsub.NewSubscriber
func WithDisconnector ¶ added in v1.4.0
func WithDisconnector(fn disconnectorFactory) Option
WithDisconnector is a an Option to set Runner disconnector
func WithLogger ¶ added in v1.5.0
WithLogger set ups a logger for the AnyCable app
func WithShutdownable ¶ added in v1.3.0
func WithShutdownable(instance Shutdownable) Option
WithShutdowable adds a new shutdownable instance to be shutdown at server stop
func WithSubscriber ¶ added in v1.2.3
func WithSubscriber(fn subscriberFactory) Option
WithSubscriber is an Option to set Runner subscriber
func WithTelemetry ¶ added in v1.4.0
WithTelemetry enables AnyCable telemetry unless ANYCABLE_DISABLE_TELEMETRY is set. You can pass custom properties as pairs of key and value.
func WithWebSocketEndpoint ¶ added in v1.3.0
WithWebSocketEndpoint is an Option to set a custom websocket handler at the specified path
func WithWebSocketHandler ¶ added in v1.3.0
func WithWebSocketHandler(fn websocketHandler) Option
WithWebSocketHandler is an Option to set a custom websocket handler
type Runner ¶ added in v1.1.0
type Runner struct {
// contains filtered or unexported fields
}
func (*Runner) Embed ¶ added in v1.5.0
Embed starts the application without setting up HTTP handlers, signalts, etc. You can use it to embed AnyCable into your own Go HTTP application.
func (*Runner) Instrumenter ¶ added in v1.4.0
func (r *Runner) Instrumenter() metricspkg.Instrumenter
func (*Runner) Router ¶ added in v1.2.0
func (r *Runner) Router() *router.RouterController
func (*Runner) SetRouter ¶ added in v1.2.0
func (r *Runner) SetRouter(router *router.RouterController)