Leptos Server Sent Events
Server signals are leptos signals kept in sync with the server through server-sent-events (SSE).
The signals are read-only on the client side, and can be written to by the server. This is useful if you want real-time updates on the UI controlled by the server.
Changes to a signal are sent through a SSE to the client as json patches.
This project is heavily based on leptos_server_signal.
Feature flags
ssr: ssr is enabled when rendering the app on the server.actix: integration with the Actix web framework.axum: integration with the Axum web framework.
Example
Cargo.toml
[]
= "*"
= { = "*", = ["derive"] }
[]
= [
"leptos_sse/ssr",
"leptos_sse/axum", # or actix
]
Client
use *;
use create_sse_signal;
use ;
If on stable, use
count.get().valueinstead ofcount().value.
Server (Axum)
use ;
async
License
This work is released under the MIT license. A copy of the license is provided in the LICENSE file.