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 struct initialization, the server implements http.Handler interface.
Functions ¶
func BroadcastMessage ¶
func BroadcastMessage(data, eventName string)
BroadcastMessage is a wrapper function for a SSE message sending.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.