Documentation
¶
Overview ¶
Package monitor provides a real-time web dashboard for a DDS participant. It embeds a single-page HTML UI (Server-Sent Events) and exposes an HTTP server that streams DDS samples and participant metrics to any browser.
Usage:
p, _ := rtps.New(dds.Domain(0))
mon, _ := monitor.New(p, monitor.Options{Addr: ":8080"})
defer mon.Close()
// browse http://localhost:8080
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor wraps a dds.Participant and serves a real-time web dashboard.
func New ¶
func New(p dds.Participant, opts Options) (*Monitor, error)
New creates a Monitor wrapping p and starts the HTTP server. The caller must call Close() to release the HTTP listener.
func (*Monitor) Addr ¶
Addr returns the address the HTTP server is listening on (useful when Addr was ":0" to let the OS pick a port).
func (*Monitor) Publish ¶
Publish emits a sample event to all connected browser clients. Call this whenever a sample is written or received that should appear in the dashboard.
func (*Monitor) PublishSafetyEvent ¶ added in v0.12.1
func (m *Monitor) PublishSafetyEvent(e safety.SafetyEvent)
PublishSafetyEvent broadcasts a safety violation event to all connected SSE clients.
func (*Monitor) WatchSafety ¶ added in v0.12.1
func (m *Monitor) WatchSafety(events <-chan safety.SafetyEvent)
WatchSafety starts a goroutine that reads from events and calls PublishSafetyEvent for each one. It stops when the monitor is closed or the channel is closed. Intended to be wired to E2ESubscriber.SafetyEvents().