+SSE send

This commit is contained in:
Miki 2024-01-05 13:31:33 +00:00
parent 55dc87af43
commit c05c44a13e
20 changed files with 217 additions and 198 deletions

View file

@ -5,6 +5,7 @@ import (
"fmt"
"io"
"log"
"slices"
"strconv"
"strings"
@ -124,7 +125,9 @@ func (e *Event) Send(msg Message) {
e.Id++
msg.Id = strconv.Itoa(e.Id)
for _, client := range e.Clients {
client.Chan <- msg
if slices.Contains(client.Events, msg.Event) || slices.Contains(client.Events, "*") {
client.Chan <- msg
}
}
}