mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 07:21:05 +00:00
32 lines
1.4 KiB
HTML
32 lines
1.4 KiB
HTML
<html>
|
|
<head>
|
|
<link rel="stylesheet" href="/stylesheet.css">
|
|
<script src="/htmx/htmx.js"></script>
|
|
<script src="/htmx/ext/sse.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="header"></div>
|
|
<div id="page" hx-ext="sse" sse-url="http://localhost/posts.html?types=Event1%2cEvent2%2cEvent3%2cEvent4">
|
|
<h1><a href="index.html">SSE Test Server</a> - Event Trigger Test</h1>
|
|
|
|
<h3>Description</h3>
|
|
<p>
|
|
This page connects to a single different Server Sent Event (SSE) streams, listening on events named "Event1", "Event2", "Event3", and "Event4".
|
|
Each event is used as a trigger for hx-get to load a random page from the server.
|
|
</p>
|
|
<h3>Example HTML</h3>
|
|
<pre class="code">
|
|
<div hx-ext="sse" sse-url="http://localhost/posts.html?types=Event1%2cEvent2%2cEvent3%2cEvent4">
|
|
<div hx-get="http://localhost/page/random" hx-trigger="sse:Event1">Waiting for Posts...</div>
|
|
</div>
|
|
</pre>
|
|
<h3>Test Cases</h3>
|
|
<div class="container" hx-get="http://localhost/page/random" hx-trigger="sse:Event1">Waiting for Posts in Event1 channel...</div>
|
|
<div class="container" hx-get="http://localhost/page/random" hx-trigger="sse:Event2">Waiting for Posts in Event2 channel...</div>
|
|
<div class="container" hx-get="http://localhost/page/random" hx-trigger="sse:Event3">Waiting for Posts in Event3 channel...</div>
|
|
<div class="container" hx-get="http://localhost/page/random" hx-trigger="sse:Event4">Waiting for Posts in Event4 channel...</div>
|
|
</div>
|
|
</body>
|
|
</html>
|