config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: MIT Imports: 2 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled    bool           `yaml:"enabled"`
	Server     ServerConfig   `yaml:"server"`
	Routing    RoutingConfig  `yaml:"routing"`
	Security   SecurityConfig `yaml:"security"`
	TenantMode string         `yaml:"tenantMode"`
	Events     EventsConfig   `yaml:"events"`
}

Config holds the WebSocket module configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a Config with sensible defaults.

func (*Config) Key

func (c *Config) Key() string

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the configuration for errors.

type EventsConfig

type EventsConfig struct {
	AllowedEventTypes   []string `yaml:"allowedEventTypes"`
	InternalEventPrefix string   `yaml:"internalEventPrefix"`
	// PresenceDebounce is the grace window before a user's "went offline"
	// presence transition is broadcast, so a quick reconnect (page reload,
	// brief network blip) doesn't flicker. Set to 0 to disable debouncing.
	PresenceDebounce time.Duration `yaml:"presenceDebounce"`
}

EventsConfig holds event bridging settings.

type RoutingConfig

type RoutingConfig struct {
	MaxTopicLength         int `yaml:"maxTopicLength"`
	MaxTopicsPerConnection int `yaml:"maxTopicsPerConnection"`
}

RoutingConfig holds message routing settings.

type SecurityConfig

type SecurityConfig struct {
	AuthRequired bool     `yaml:"authRequired"`
	AllowOrigins []string `yaml:"allowOrigins"`
	JWTSecret    string   `yaml:"jwtSecret"`
}

SecurityConfig holds WebSocket security settings.

type ServerConfig

type ServerConfig struct {
	Host            string        `yaml:"host"`
	Port            string        `yaml:"port"`
	ReadBufferSize  int           `yaml:"readBufferSize"`
	WriteBufferSize int           `yaml:"writeBufferSize"`
	ReadDeadline    time.Duration `yaml:"readDeadline"`
	WriteDeadline   time.Duration `yaml:"writeDeadline"`
	// PingInterval controls how often the server sends a WebSocket ping
	// frame to keep idle connections (and any intermediate proxies/load
	// balancers) alive. Set to 0 to disable.
	PingInterval            time.Duration `yaml:"pingInterval"`
	MaxConnections          int64         `yaml:"maxConnections"`
	MaxConnectionsPerUser   int           `yaml:"maxConnectionsPerUser"`
	MaxConnectionsPerTenant int           `yaml:"maxConnectionsPerTenant"`
}

ServerConfig holds WebSocket server settings.

Jump to

Keyboard shortcuts

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