=sse update event

This commit is contained in:
Miki 2024-01-07 11:54:29 +00:00
parent 2464596698
commit 066b72385e
12 changed files with 56 additions and 36 deletions

BIN
sse/be/be

Binary file not shown.

View file

@ -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 {

View file

@ -1 +1 @@
{"version":"1704556541085"}
{"version":"1704628342008"}

Binary file not shown.

Binary file not shown.

View file

@ -5,17 +5,17 @@
<link rel="icon" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="modulepreload" href="/_app/immutable/entry/start.IlXTmMTk.js">
<link rel="modulepreload" href="/_app/immutable/entry/start.yEbS545I.js">
<link rel="modulepreload" href="/_app/immutable/chunks/scheduler.k-kUyWhY.js">
<link rel="modulepreload" href="/_app/immutable/chunks/singletons.JSxIQYeI.js">
<link rel="modulepreload" href="/_app/immutable/entry/app.sUqO_5CB.js">
<link rel="modulepreload" href="/_app/immutable/chunks/singletons.sQrbzYB-.js">
<link rel="modulepreload" href="/_app/immutable/entry/app.zjPk-GsH.js">
<link rel="modulepreload" href="/_app/immutable/chunks/index.PctGSwCt.js">
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">
<script>
{
__sveltekit_qniv18 = {
__sveltekit_bea7py = {
base: "",
env: null
};
@ -23,8 +23,8 @@
const element = document.currentScript.parentElement;
Promise.all([
import("/_app/immutable/entry/start.IlXTmMTk.js"),
import("/_app/immutable/entry/app.sUqO_5CB.js")
import("/_app/immutable/entry/start.yEbS545I.js"),
import("/_app/immutable/entry/app.zjPk-GsH.js")
]).then(([kit, app]) => {
kit.start(app, element);
});

Binary file not shown.

Binary file not shown.

View file

@ -5,17 +5,17 @@
<link rel="icon" href="../favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="modulepreload" href="../_app/immutable/entry/start.IlXTmMTk.js">
<link rel="modulepreload" href="../_app/immutable/entry/start.yEbS545I.js">
<link rel="modulepreload" href="../_app/immutable/chunks/scheduler.k-kUyWhY.js">
<link rel="modulepreload" href="../_app/immutable/chunks/singletons.JSxIQYeI.js">
<link rel="modulepreload" href="../_app/immutable/entry/app.sUqO_5CB.js">
<link rel="modulepreload" href="../_app/immutable/chunks/singletons.sQrbzYB-.js">
<link rel="modulepreload" href="../_app/immutable/entry/app.zjPk-GsH.js">
<link rel="modulepreload" href="../_app/immutable/chunks/index.PctGSwCt.js">
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">
<script>
{
__sveltekit_qniv18 = {
__sveltekit_bea7py = {
base: new URL("..", location).pathname.slice(0, -1),
env: null
};
@ -23,8 +23,8 @@
const element = document.currentScript.parentElement;
Promise.all([
import("../_app/immutable/entry/start.IlXTmMTk.js"),
import("../_app/immutable/entry/app.sUqO_5CB.js")
import("../_app/immutable/entry/start.yEbS545I.js"),
import("../_app/immutable/entry/app.zjPk-GsH.js")
]).then(([kit, app]) => {
kit.start(app, element);
});

Binary file not shown.

Binary file not shown.