Documentation
¶
Index ¶
- Variables
- func ParseMaxMessageSizeBytes[V int | string](value V) uint32
- type Server
- func (s *Server) AddSubscriber(ws *websocket.Conn, realIP string, opts *SubscriberOptions) (*Subscriber, error)
- func (s *Server) Emit(ctx context.Context, e *models.Event, asJSON, compBytes []byte) error
- func (s *Server) GetSeq() int64
- func (s *Server) HandleSubscribe(c echo.Context) error
- func (s *Server) RemoveSubscriber(num int64)
- func (s *Server) SetSeq(seq int64)
- type Subscriber
- type SubscriberOptions
- type SubscriberOptionsUpdatePayload
- type SubscriberSourcedMessage
- type WantedCollections
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidOptions = fmt.Errorf("invalid subscriber options")
ErrInvalidOptions is returned when the subscriber options are invalid
View Source
var SubMessageOptionsUpdate = "options_update"
Functions ¶
func ParseMaxMessageSizeBytes ¶
ParseMaxMessageSizeBytes parses a max size value string or integer and returns a uint32. If the value is less than 0, it returns 0. If the value is not a valid integer, it returns 0.
Types ¶
type Server ¶
type Server struct {
Subscribers map[int64]*Subscriber
Consumer *consumer.Consumer
// contains filtered or unexported fields
}
func (*Server) AddSubscriber ¶
func (s *Server) AddSubscriber(ws *websocket.Conn, realIP string, opts *SubscriberOptions) (*Subscriber, error)
func (*Server) RemoveSubscriber ¶
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
func (*Subscriber) SetCursor ¶
func (s *Subscriber) SetCursor(cursor *int64)
func (*Subscriber) Terminate ¶
func (s *Subscriber) Terminate(reason string) error
Terminate sends a close message to the subscriber
func (*Subscriber) UpdateOptions ¶
func (s *Subscriber) UpdateOptions(opts *SubscriberOptions)
func (*Subscriber) WantsCollection ¶
func (sub *Subscriber) WantsCollection(collection string) bool
WantsCollection returns true if the subscriber wants the given collection
func (*Subscriber) WriteMessage ¶
func (s *Subscriber) WriteMessage(msgType int, data []byte) error
type SubscriberOptions ¶
type SubscriberOptions struct {
WantedCollections *WantedCollections
WantedDIDs map[string]struct{}
MaxMessageSizeBytes uint32
Compress bool
Cursor *int64
}
type SubscriberSourcedMessage ¶
type SubscriberSourcedMessage struct {
Type string `json:"type"`
Payload json.RawMessage `json:"payload"`
}
type WantedCollections ¶
Click to show internal directories.
Click to hide internal directories.