Template
1
0
Fork 0
goth.stack/pages/templates/tools.ssedemo.html

42 lines
1.3 KiB
HTML
Raw Normal View History

2025-01-12 14:51:43 -06:00
{{define "title"}}
GOTH Stack // Tools // SSE Demo
{{end}}
{{define "navcontent"}}
GOTH Stack // Tools // SSE Demo
{{end}}
2024-03-27 14:52:28 -06:00
2025-01-12 14:51:43 -06:00
{{define "description"}}
A demo of an SSE implimentation.
2024-03-27 14:52:28 -06:00
{{end}}
{{define "head"}}
2024-05-07 18:03:54 -06:00
<link rel="stylesheet" href="/public/css/styles.css" />
2024-03-27 14:52:28 -06:00
{{end}}
{{define "main"}}
2024-03-27 15:26:31 -06:00
<h2 class="text-2xl font-extrabold tracking-tight text-white sm:text-[2rem]">Server Sent Events Demo</h2>
2024-03-27 14:52:28 -06:00
<p class="text-lg">This page demonstrates the use of the <a href="https://htmx.org/extensions/sse/">HTMX SSE
Extention</a> to receive Server Sent Events on the "default" channel.</p>
<p class="text-lg">Any events received on the "default" channel will appear below:</p>
<div hx-ext="sse" sse-connect="/api/sse" sse-swap="message">
Waiting for SSE Message...
</div>
<p class="text-lg">Here you can send messages on the default channel:</p>
<form hx-post="/api/tools/sendsse" hx-trigger="submit" hx-swap="none" class="flex-col flex gap-2">
<div class="label">
<span class="label-text">Message</span>
</div>
<input type="text" name="message" value="Hello world!" placeholder="Enter your message here"
class="input input-bordered input-primary w-full max-w-xs" />
<button type="submit" class="btn btn-primary">Send Event</button>
</form>
{{end}}
{{define "foot"}}
<script src="/public/js/htmx.sse.js"></script>
2024-10-30 23:50:34 -06:00
{{end}}