sseserver

package
v1.4.13 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SSERouteBroadcast       = "eventv2.broadcast"
	SSEventsExchange        = "ror.eventsv2"
	SSEventsQueueNamePrefix = "sse-events-v2"
)

Variables

This section is empty.

Functions

func HandleSSEEvent added in v1.0.50

func HandleSSEEvent(ctx context.Context, message amqp091.Delivery) error

func StartEventServer

func StartEventServer()

func StartListeningRabbitMQ added in v1.0.50

func StartListeningRabbitMQ()

Types

type EventClient

type EventClient struct {
	Id            EventClientId
	Connection    EventClientChan
	Identity      identitymodels.Identity
	Subscriptions []Subscription
}

func (*EventClient) Subscribe added in v1.1.0

func (e *EventClient) Subscribe(topic Subscription)

func (*EventClient) Unsubscribe added in v1.1.0

func (e *EventClient) Unsubscribe(topic Subscription)

type EventClientChan

type EventClientChan chan SseEvent

type EventClientId

type EventClientId string

func NewEventClientId

func NewEventClientId() EventClientId

type EventClients

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

func NewEventClients

func NewEventClients() EventClients

func (*EventClients) Add

func (e *EventClients) Add(client *EventClient)

func (*EventClients) Get

func (*EventClients) GetBroadcast

func (e *EventClients) GetBroadcast() []EventClientId

func (*EventClients) Len

func (e *EventClients) Len() int

func (*EventClients) Remove

func (e *EventClients) Remove(id EventClientId)

type EventMessage

type EventMessage struct {
	Clients []EventClientId
	SseEvent
}

type EventServer

type EventServer struct {
	// Events are pushed to this channel by the main events-gathering routine
	Message chan EventMessage

	// New client connections
	NewClients chan *EventClient

	// Closed client connections
	ClosedClients chan EventClientId

	// Total client connections
	Clients EventClients
}
var Server *EventServer

type SSESubscribe added in v1.1.0

type SSESubscribe struct {
	ClientId EventClientId `json:"clientId" validate:"required"`
	Topic    Subscription  `json:"topic" validate:"required"`
}

type SseEvent

type SseEvent struct {
	Event string `json:"event"`
	Data  string `json:"data" validate:"required"`
}

type Subscription added in v1.1.0

type Subscription string

Jump to

Keyboard shortcuts

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