sse

package
v1.35.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricActiveConnections = "active_connections"
	MetricEventsSent        = "events_sent_total"
	MetricConnectionErrors  = "connection_errors_total"
	MetricEventLatency      = "event_delivery_latency_seconds"
	MetricKeepalivesSent    = "keepalives_sent_total"

	LabelEventType = "event_type"
	LabelErrorType = "error_type"

	ErrorTypeBufferFull   = "buffer_full"
	ErrorTypeNoConnection = "no_connection"
	ErrorTypeWriteFailure = "write_failure"
	ErrorTypeMarshalError = "marshal_error"
)

Metric constants.

Variables

View Source
var (
	ErrNoConnection = errors.New("no connection")
)

Functions

func Module

func Module() fx.Option

Types

type Config

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

func DefaultConfig added in v1.34.3

func DefaultConfig() Config

func NewConfig

func NewConfig(opts ...Option) Config

func (*Config) KeepAlivePeriod

func (c *Config) KeepAlivePeriod() time.Duration

type Event

type Event struct {
	Type smsgateway.PushEventType `json:"event"`
	Data map[string]string        `json:"data"`
}

type Option added in v1.34.3

type Option func(*Config)

func WithKeepAlivePeriod

func WithKeepAlivePeriod(d time.Duration) Option

type Service

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

func NewService

func NewService(config Config, logger *zap.Logger, metrics *metrics) *Service

func (*Service) Close

func (s *Service) Close(_ context.Context) error

func (*Service) Handler

func (s *Service) Handler(deviceID string, c *fiber.Ctx) error

func (*Service) Send

func (s *Service) Send(deviceID string, event Event) error

Jump to

Keyboard shortcuts

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