Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Module = fx.Module( "vef:push", fx.Provide( NewHub, fx.Annotate( NewRelay, fx.ParamTags(``, ``, ``, ``, `optional:"true"`), ), newNotifier, fx.Annotate( NewMiddleware, fx.ResultTags(`group:"vef:app:middlewares"`), ), fx.Annotate( newRevocationListener, fx.ResultTags(`group:"vef:security:session_revocation_listeners"`), ), ), fx.Invoke(registerLifecycle), )
Functions ¶
func NewMiddleware ¶
func NewMiddleware(params MiddlewareParams) app.Middleware
NewMiddleware creates the push endpoint middleware. Returns nil while the endpoint is disabled.
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub is the per-node connection registry and the push.Notifier implementation: it indexes live connections by user and fans each message out to the selected recipients through their writer queues.
func NewHub ¶
func NewHub(cfg *config.PushConfig) *Hub
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware mounts the push WebSocket endpoint: an app.Middleware registering a real route (MCP precedent) that authenticates the handshake with the configured token mechanism before upgrading.
func (*Middleware) Apply ¶
func (m *Middleware) Apply(router fiber.Router)
func (*Middleware) Name ¶
func (*Middleware) Name() string
func (*Middleware) Order ¶
func (*Middleware) Order() int
Order places the endpoint after the API engine and before the SPA fallback, alongside the integration inbound gateway and MCP.
type MiddlewareParams ¶
type MiddlewareParams struct {
fx.In
Hub *Hub
Auth security.AuthManager
Store security.SessionStore
Config *config.PushConfig
Security *config.SecurityConfig
}
MiddlewareParams contains dependencies for creating the middleware.
type Relay ¶
type Relay struct {
// contains filtered or unexported fields
}
func NewRelay ¶
func NewRelay(hub *Hub, cfg *config.PushConfig, appCfg *config.AppConfig, redisCfg *config.RedisConfig, client *redis.Client) (*Relay, error)
NewRelay builds the cross-node relay; nil when the endpoint is disabled or no Redis client is available (single-node deployments push through the hub directly). An active relay fails fast without an application name: the channel namespace is what keeps co-tenant applications apart, so an unnamed application must not come up silently sharing a channel.
func (*Relay) KickSessions ¶
KickSessions closes the sessions' connections on every node. The publish is handed to the relay's bounded worker: kicks arrive through revocation call paths (logout, concurrent-login eviction) whose listener contract forbids blocking on Redis health, and a goroutine per kick would grow without bound under a Redis outage. A full queue drops the frame — the remote nodes' periodic sweep remains the net.