Skip to content

Commit

Permalink
fix immediate loading of cached viewers
Browse files Browse the repository at this point in the history
  • Loading branch information
louisheal committed Jan 9, 2025
1 parent a0e143b commit b1217fe
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions controllers/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ func (c *OverlayController) HandleListen(ctx *gin.Context) {
ticker := time.NewTicker(60 * time.Second)
defer ticker.Stop()

for _, viewer := range c.Cache.GetViewers(channelID) {
ctx.SSEvent("JOIN", viewer)
}
go func() {
for _, viewer := range c.Cache.GetViewers(channelID) {
client.Stream <- services.Event{Event: "JOIN", Message: viewer}
}
}()

ctx.Stream(func(w io.Writer) bool {
select {
Expand Down

0 comments on commit b1217fe

Please sign in to comment.