Versions in this module Expand all Collapse all v0 v0.1.3 Jul 3, 2026 v0.1.2 Jul 2, 2026 Changes in this version type Hub + func (hub *Hub) Configure(config Config) *Hub v0.1.1 Jul 1, 2026 v0.1.0 Jun 30, 2026 Changes in this version + const EventPing + const EventPong + const EventSubscribe + const EventUnsubscribe + func Mount(target route.Target, hub *Hub) + func Provider(hubs ...*Hub) provider.Provider + type Authenticator func(ctx *route.Context) (*Identity, error) + type Broker interface + Close func(ctx context.Context) error + Publish func(ctx context.Context, channel string, packet Packet) error + Subscribe func(ctx context.Context, node string, fn func(Packet) error) error + func MessageBroker(driver message.BrokerDriver, topics ...string) Broker + func NewMemoryBroker() Broker + type ChannelInfo struct + Clients int + Name string + type Client struct + func (client *Client) Close(reason CloseReason) error + func (client *Client) ID() string + func (client *Client) Identity() Identity + func (client *Client) Send(event string, data any) error + func (client *Client) Subscribe(channel string) error + func (client *Client) Unsubscribe(channel string) error + type ClientInfo struct + Channels []string + Connected time.Time + ID string + IP string + LastSeen time.Time + Meta core.Map + Name string + Node string + UserAgent string + type CloseReason string + type Config struct + Auth Authenticator + Broker Broker + MaxMessageSize int64 + Node string + Origin []string + PingInterval time.Duration + PongTimeout time.Duration + Presence Presence + ReadTimeout time.Duration + SendBuffer int + WriteTimeout time.Duration + type Context struct + func (ctx *Context) Bind(output any) error + func (ctx *Context) Can(name string) error + func (ctx *Context) Client() *Client + func (ctx *Context) Context() context.Context + func (ctx *Context) Error(code string, message string) error + func (ctx *Context) Hub() *Hub + func (ctx *Context) Identity() Identity + func (ctx *Context) Message() Message + func (ctx *Context) Publish(channel string, event string, data any) error + func (ctx *Context) Reply(data any) error + func (ctx *Context) Scope() *scope.Scope + func (ctx *Context) Send(event string, data any) error + func (ctx *Context) SetContext(value context.Context) + func (ctx *Context) Subscribe(channel string) error + func (ctx *Context) Unsubscribe(channel string) error + type Filter func(ClientInfo) bool + func ByChannel(channel string) Filter + func ByID(id string) Filter + type Handler func(ctx *Context) error + type Hub struct + func New(name string, config Config) *Hub + func (hub *Hub) Broadcast(event string, data any) error + func (hub *Hub) BroadcastContext(ctx context.Context, event string, data any) error + func (hub *Hub) Channel(name string) ChannelInfo + func (hub *Hub) Channels() []ChannelInfo + func (hub *Hub) Check(context.Context) host.Health + func (hub *Hub) Client(id string) (*ClientInfo, bool) + func (hub *Hub) Clients(filters ...Filter) []ClientInfo + func (hub *Hub) HostName() string + func (hub *Hub) Kick(clientID string, reason CloseReason) error + func (hub *Hub) KickChannel(channel string, reason CloseReason) error + func (hub *Hub) KickMany(clientIDs []string, reason CloseReason) error + func (hub *Hub) Name() string + func (hub *Hub) On(event string, handler Handler) *Hub + func (hub *Hub) OnPublish(fn PublishHook) *Hub + func (hub *Hub) OnSubscribe(fn SubscribeHook) *Hub + func (hub *Hub) Publish(channel string, event string, data any) error + func (hub *Hub) PublishContext(ctx context.Context, channel string, event string, data any) error + func (hub *Hub) Send(clientID string, event string, data any) error + func (hub *Hub) SendContext(ctx context.Context, clientID string, event string, data any) error + func (hub *Hub) SendMany(clientIDs []string, event string, data any) error + func (hub *Hub) Serve(ctx *route.Context) error + func (hub *Hub) Start(ctx context.Context) error + func (hub *Hub) Stats() Stats + func (hub *Hub) Status() host.Status + func (hub *Hub) Stop(ctx context.Context) error + func (hub *Hub) Use(middlewares ...Middleware) *Hub + type Identity struct + ID string + Meta core.Map + Name string + type Message struct + Channel string + Data core.JSONRaw + Event string + ID string + Meta core.Map + type Middleware func(Handler) Handler + type Packet struct + Channel string + Data any + Event string + Meta core.Map + Origin string + type Presence interface + Channels func(ctx context.Context) ([]ChannelInfo, error) + Clients func(ctx context.Context, filter ...Filter) ([]ClientInfo, error) + Close func(ctx context.Context) error + Remove func(ctx context.Context, clientID string) error + Set func(ctx context.Context, client ClientInfo) error + func NewMemoryPresence() Presence + type PublishHook func(ctx context.Context, channel string, event string, data any) error + type Registry struct + func (registry *Registry) Add(hubs ...*Hub) + func (registry *Registry) Hubs() []*Hub + type Response struct + Code string + Data any + Event string + ID string + Message string + Meta core.Map + OK bool + type Stats struct + BytesIn uint64 + BytesOut uint64 + Channels int + Clients int + MessagesIn uint64 + MessagesOut uint64 + type SubscribeHook func(ctx *Context, channel string) error