Updates from my site

This commit is contained in:
2024-02-06 11:03:53 -07:00
parent bfc56fffcf
commit a450b648d5
12 changed files with 280 additions and 159 deletions

View File

@ -7,7 +7,7 @@ import (
"goth.stack/lib"
)
func SSEDemoSend(c echo.Context) error {
func SSEDemoSend(c echo.Context, pubSub lib.PubSub) error {
channel := c.QueryParam("channel")
if channel == "" {
channel = "default"
@ -30,8 +30,7 @@ func SSEDemoSend(c echo.Context) error {
return c.JSON(http.StatusBadRequest, map[string]string{"error": "message parameter is required"})
}
// Send message
lib.SendSSE("default", message)
lib.SendSSE(c.Request().Context(), pubSub, "default", message)
return c.JSON(http.StatusOK, map[string]string{"status": "message sent"})
}