websocket

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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

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

Module implements the WebSocket module for NebularCore.

func New

func New(bus event.Bus, opts ...Option) *Module

New creates a new WebSocket module. The event.Bus is required for event bridging between WebSocket clients and the internal event system. Options (e.g. WithValidator) are applied before Initialize starts the event bridge, so callers can safely register topic-authorization rules here.

func (*Module) Adapter

func (m *Module) Adapter() *store.Adapter

Adapter returns the adapter for other modules to interact with WebSocket connections.

func (*Module) Configure

func (m *Module) Configure(config config.Config) error

Configure implements module.Module.

func (*Module) Dependencies

func (m *Module) Dependencies() []string

Dependencies implements module.Module.

func (*Module) GetMigrationSources

func (m *Module) GetMigrationSources(projectRoot string) []migration_runner.Source

GetMigrationSources implements module.Module.

func (*Module) Initialize

func (m *Module) Initialize(ctx context.Context, db *gorm.DB, ginRouter *gin.Engine) error

Initialize implements module.Module.

func (*Module) Manager

func (m *Module) Manager() *connections.Manager

Manager returns the connection manager for external access.

func (*Module) MigrationsDir

func (m *Module) MigrationsDir() string

MigrationsDir implements module.Module.

func (*Module) Name

func (m *Module) Name() string

Name implements module.Module.

func (*Module) Namespace

func (m *Module) Namespace() module.ModuleNamespace

Namespace implements module.Module.

func (*Module) NewConfig

func (m *Module) NewConfig() config.Config

NewConfig implements module.Module.

func (*Module) ProvidesMigrations

func (m *Module) ProvidesMigrations() bool

ProvidesMigrations implements module.Module.

func (*Module) Shutdown

func (m *Module) Shutdown(ctx context.Context) error

Shutdown implements module.Module.

func (*Module) Subscriptions

func (m *Module) Subscriptions() *store.Subscriptions

Subscriptions returns the subscription store.

func (*Module) Validators

func (m *Module) Validators() *store.ValidatorRegistry

Validators returns the topic validator registry, populated from any WithValidator options after Initialize has run.

func (*Module) Version

func (m *Module) Version() string

Version implements module.Module.

type Option

type Option func(*Module)

Option configures a Module before Initialize runs.

func WithClaimsResolver

func WithClaimsResolver(resolve wsauth.ClaimsResolverFunc) Option

WithClaimsResolver overrides token verification for the /ws upgrade handshake to use resolve instead of Config.Security's fixed HS256 shared secret — for hosts whose own tokens are signed with a different algorithm (e.g. RS256) and already have a TokenIssuer that knows how to validate them.

func WithValidator

func WithValidator(pattern string, fn store.TopicValidatorFunc) Option

WithValidator registers a topic validator for topics matching pattern, applied once Initialize builds the module's ValidatorRegistry. Multiple options may be supplied; all are applied in order.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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