Documentation ¶
Overview ¶
The package to provide a server-side instance for the SSE message streaming.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Streamer = &sse.Server{ Provider: &sse.Joe{ ReplayProvider: &sse.ValidReplayProvider{ TTL: time.Minute * 5, GCInterval: time.Minute, AutoIDs: true, }, }, OnSession: func(s *sse.Session) (sse.Subscription, bool) { topics := s.Req.URL.Query()["topic"] for _, topic := range topics { if topic != topicRandomNumbers && topic != topicMetrics { } } if len(topics) == 0 { topics = []string{topicRandomNumbers, topicMetrics} } return sse.Subscription{ Client: s, LastEventID: s.LastEventID, Topics: append(topics, sse.DefaultTopic), }, true }, }
Core SSE server as the HTTP handler wrapper.
Functions ¶
func BroadcastMessage ¶
func BroadcastMessage(payload EventPayload)
BroadcastMessage is a wrapper function for a SSE message sending.
Types ¶
type EventPayload ¶ added in v0.44.11
EventPayload is the metastructure to organize the SSE event's data association better. It is an input for the BroadcastMessage function.
Click to show internal directories.
Click to hide internal directories.