a32cdbc117
This adds Server-Sent Events (SSE) support to the web package, enabling
real-time updates in web applications built with go-micro.
Features:
- SSEBroadcaster manages connected clients and broadcasts events
- Integrates with events.Stream for subscribing to topics
- Supports JSON events and raw HTML (for htmx/datastar)
- Keep-alive mechanism for long-lived connections
- Thread-safe client management
Usage:
broadcaster := web.NewSSEBroadcaster(
web.WithStream(stream),
web.WithTopics("posts", "comments"),
)
broadcaster.Start()
router.GET("/events", broadcaster.Handler())
This enables real-time features requested in #2788, including:
- Live updates without page refresh
- htmx/datastar integration
- Foundation for MCP (Model Context Protocol) support
Closes #2788
Co-authored-by: Shelley <shelley@exe.dev>