Compare commits
No commits in common. "main" and "v0.12.14" have entirely different histories.
@ -17,7 +17,6 @@ type Server interface {
|
||||
GinHandlerFunc(auth func(c *gin.Context) (string, error)) gin.HandlerFunc
|
||||
Push(user any, name, msg string) bool
|
||||
Broadcast(name, msg string)
|
||||
ClientCount() int32
|
||||
}
|
||||
|
||||
type clientChan struct {
|
||||
@ -91,10 +90,6 @@ func (stream *event) HandlerFunc() mux.HandlerFunc {
|
||||
c.Context().Writer.Header().Set("Connection", "keep-alive")
|
||||
c.Context().Writer.Header().Set("Transfer-Encoding", "chunked")
|
||||
|
||||
time.AfterFunc(time.Second, func() {
|
||||
e <- msgChan{Name: "message", Message: "success"}
|
||||
})
|
||||
|
||||
c.Context().Stream(func(w io.Writer) bool {
|
||||
if msg, ok := <-e; ok {
|
||||
c.Context().SSEvent(msg.Name, msg.Message)
|
||||
@ -158,7 +153,3 @@ func (stream *event) Broadcast(name, msg string) {
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
func (stream *event) ClientCount() int32 {
|
||||
return stream.Count.Load()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user