Documentation
¶
Index ¶
- type HTTPSender
- func (s *HTTPSender) Endpoints() []config.NotifyEndpointConfig
- func (s *HTTPSender) Send(p *NotifyPayload)
- func (s *HTTPSender) Start()
- func (s *HTTPSender) Stop()
- func (s *HTTPSender) StopWithTimeout(timeout time.Duration) bool
- func (s *HTTPSender) UpdateEndpoints(endpoints []config.NotifyEndpointConfig)
- type Module
- type NotifyPayload
- type WSSender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPSender ¶
type HTTPSender struct {
// contains filtered or unexported fields
}
HTTPSender delivers webhook notifications to configured endpoints.
func NewHTTPSender ¶
func NewHTTPSender(endpoints []config.NotifyEndpointConfig) *HTTPSender
NewHTTPSender creates a new HTTP webhook sender.
func (*HTTPSender) Endpoints ¶
func (s *HTTPSender) Endpoints() []config.NotifyEndpointConfig
Endpoints returns a copy of the active webhook policy.
func (*HTTPSender) Send ¶
func (s *HTTPSender) Send(p *NotifyPayload)
Send enqueues a payload for delivery. Non-blocking; drops if queue is full.
func (*HTTPSender) Start ¶
func (s *HTTPSender) Start()
Start begins the worker goroutine that drains the queue.
func (*HTTPSender) Stop ¶
func (s *HTTPSender) Stop()
Stop signals the worker to exit and waits for drain.
func (*HTTPSender) StopWithTimeout ¶
func (s *HTTPSender) StopWithTimeout(timeout time.Duration) bool
StopWithTimeout signals the worker, drains events admitted before the stop, and waits up to timeout. A non-positive timeout waits without a deadline.
func (*HTTPSender) UpdateEndpoints ¶
func (s *HTTPSender) UpdateEndpoints(endpoints []config.NotifyEndpointConfig)
UpdateEndpoints publishes a copied endpoint list for subsequent deliveries.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module implements HTTP and WebSocket notifications for stream lifecycle events.
func (*Module) Hooks ¶
func (m *Module) Hooks() []core.HookRegistration
Hooks returns async hooks for all lifecycle events at priority 90.
type NotifyPayload ¶
type NotifyPayload struct {
Event string `json:"event"`
StreamKey string `json:"stream_key"`
Protocol string `json:"protocol,omitempty"`
RemoteAddr string `json:"remote_addr,omitempty"`
Timestamp int64 `json:"timestamp"`
Extra map[string]any `json:"extra,omitempty"`
}
NotifyPayload is the JSON body sent to webhook endpoints.
func BuildPayload ¶
func BuildPayload(eventName string, ctx *core.EventContext) *NotifyPayload
BuildPayload creates a NotifyPayload from an event name and context.
type WSSender ¶
type WSSender struct {
// contains filtered or unexported fields
}
WSSender manages WebSocket notification clients.
func NewWSSender ¶
func NewWSSender() *WSSender
NewWSSender creates a new WebSocket notification sender.
func (*WSSender) ClientCount ¶
ClientCount returns the number of connected WebSocket clients.
func (*WSSender) Close ¶
func (s *WSSender) Close()
Close permanently stops client admission and disconnects all clients.
func (*WSSender) Dropped ¶
Dropped returns the number of notification messages rejected by full client queues since the sender was created.
func (*WSSender) HandleWebSocket ¶
func (s *WSSender) HandleWebSocket(w http.ResponseWriter, r *http.Request)
HandleWebSocket upgrades an HTTP connection to a WebSocket notification stream. Query parameter "events" is a comma-separated list of event names to filter. If omitted, all events are sent.
func (*WSSender) Send ¶
func (s *WSSender) Send(p *NotifyPayload)
Send broadcasts a payload to all connected clients whose event filter matches.