Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Htmx.Lucid.Extension.ServerSentEvents
Description
The Server Sent Events extension connects to an EventSource directly from HTML. It manages the connections to your web server, listens for server events, and then swaps their contents into your htmx webpage in real-time. https://github.com/bigskysoftware/htmx-extensions/blob/main/src/sse/README.md
Synopsis
- sseConnect_ :: Text -> Attributes
- data SseEventKind
- sseSwap_ :: SseEventKind -> Attributes
Documentation
sseConnect_ :: Text -> Attributes Source #
https://github.com/bigskysoftware/htmx-extensions/tree/main/src/sse#connecting-to-an-sse-server Provide the url to connect to, in order to establish an SSE channel.
data SseEventKind Source #
A stronger type for the different kinds of events permitted by sseSwap_
sseSwap_ :: SseEventKind -> Attributes Source #
https://github.com/bigskysoftware/htmx-extensions/tree/main/src/sse#receiving-named-events event name to listen for in an SSE message, the contents of the message will be swapped into the tag this attribute is on. For named events the message structure is as follows:
event: EventName data: divContent to swap into your HTML page./divsseSwap_ :: Text -> Attributes
For unnamed events the message structure should look like this:
data: divContent to swap into your HTML page./divsseSwap_ :: Text -> Attributes