This commit is contained in:
2024-01-17 12:02:03 -07:00
parent 161cc95538
commit f8ce4e3b48
43 changed files with 1614 additions and 21 deletions

20
lib/sse.go Normal file
View File

@ -0,0 +1,20 @@
package lib
func SendSSE(channel string, message string) error {
// Create a channel to receive an error from the goroutine
errCh := make(chan error, 1)
// Use a goroutine to send the message asynchronously
go func() {
err := Publish(RedisClient, channel, message)
errCh <- err // Send the error to the channel
}()
// Wait for the goroutine to finish and check for errors
err := <-errCh
if err != nil {
return err
}
return nil
}