Versions in this module Expand all Collapse all v0 v0.34.24 Sep 22, 2023 Changes in this version + var ErrAlreadySubscribed = errors.New("already subscribed") + var ErrOutOfCapacity = errors.New("internal subscription event buffer is out of capacity") + var ErrSubscriptionNotFound = errors.New("subscription not found") + var ErrUnsubscribed = errors.New("client unsubscribed") + type Message struct + func NewMessage(data interface{}, events map[string][]string) Message + func (msg Message) Data() interface{} + func (msg Message) Events() map[string][]string + type Option func(*Server) + func BufferCapacity(cap int) Option + type Query interface + Matches func(events map[string][]string) (bool, error) + String func() string + type Server struct + func NewServer(options ...Option) *Server + func (s *Server) BufferCapacity() int + func (s *Server) NumClientSubscriptions(clientID string) int + func (s *Server) NumClients() int + func (s *Server) OnReset() error + func (s *Server) OnStart() error + func (s *Server) OnStop() + func (s *Server) Publish(ctx context.Context, msg interface{}) error + func (s *Server) PublishWithEvents(ctx context.Context, msg interface{}, events map[string][]string) error + func (s *Server) Subscribe(ctx context.Context, clientID string, query Query, outCapacity ...int) (*Subscription, error) + func (s *Server) SubscribeUnbuffered(ctx context.Context, clientID string, query Query) (*Subscription, error) + func (s *Server) Unsubscribe(ctx context.Context, clientID string, query Query) error + func (s *Server) UnsubscribeAll(ctx context.Context, clientID string) error + type Subscription struct + func NewSubscription(outCapacity int) *Subscription + func (s *Subscription) Cancelled() <-chan struct{} + func (s *Subscription) Err() error + func (s *Subscription) Out() <-chan Message