=sse update event
This commit is contained in:
parent
2464596698
commit
066b72385e
12 changed files with 56 additions and 36 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -136,6 +137,9 @@ func (e *Event) SendMessage(c *gin.Context) {
|
|||
Event: "message",
|
||||
Data: "Ciao",
|
||||
})
|
||||
e.Send(Message{
|
||||
Data: "Senza event",
|
||||
})
|
||||
}
|
||||
|
||||
func (e *Event) SendMsg(c *gin.Context) {
|
||||
|
@ -143,6 +147,7 @@ func (e *Event) SendMsg(c *gin.Context) {
|
|||
Event: "msg",
|
||||
Data: "hello",
|
||||
})
|
||||
c.JSON(http.StatusOK, gin.H{"status": "msg"})
|
||||
}
|
||||
|
||||
func (e *Event) SendPing(c *gin.Context) {
|
||||
|
@ -150,7 +155,7 @@ func (e *Event) SendPing(c *gin.Context) {
|
|||
Event: "ping",
|
||||
Data: "Ping",
|
||||
})
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{"status": "ping"})
|
||||
}
|
||||
|
||||
func (e *Event) SendPong(c *gin.Context) {
|
||||
|
@ -158,6 +163,7 @@ func (e *Event) SendPong(c *gin.Context) {
|
|||
Event: "pong",
|
||||
Data: "Pong",
|
||||
})
|
||||
c.JSON(http.StatusOK, gin.H{"status": "pong"})
|
||||
}
|
||||
|
||||
func remove(slice []Client, s *Client) []Client {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue