first commit

This commit is contained in:
2024-07-23 10:23:43 +08:00
commit 7b4c2521a3
126 changed files with 15931 additions and 0 deletions

26
pkg/sse/client.html Normal file
View File

@ -0,0 +1,26 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Server Sent Event</title>
</head>
<body>
<div id="event-data"></div>
</body>
<script>
const $stream = new EventSource("/stream");
const $log = document.querySelector('#event-data')
$stream.addEventListener("message", function (e) {
log(e.data)
});
function log(msg) {
$log.innerHTML += `<p>消息: ${msg}</p>`
$log.scrollTop += 1000
}
</script>
</html>