Tauri Plugin SSE
Server-Sent Events (SSE) is a web technology that allows a server to push real-time updates to a client over a long-lived HTTP connection.
It provides a lightweight, one-way communication channel, making it ideal for applications that need continuous data streaming from the backend without using WebSockets.
SSE is a simple solution for notifications, activity feeds, live status updates, or any scenario where the server needs to send real-time updates to the client.
This project uses the sse_client crate for handling SSE connections on the Rust side (Tauri's backend).
Sample Usage:
- Realtime activity feeds or notifications
- Live server logs
- Monitoring application state
- Synchronizing lightweight UI updates
| Platform | Supported |
|---|---|
| Linux | ✓ |
| Windows | ✓ |
| macOS | not tested |
| Android | not tested |
| iOS | not tested |
Installation
- Crate: https://crates.io/crates/tauri-plugin-sse
cargo add tauri-plugin-sse
Usage
TypeScript/JavaScript
import EventSource from "tauri-plugin-sse";
// Create connection to server endpoint
const source = ;
// Handle on establishing connection
source ;
// Fired when a message is received
source ;
// Handle errors
source ;
// Handle named event types
source.;
// Remove handler
;
// Close Event Source
source.;
Rust
// TODO: Add use of right modules
// Create connection to server endpoint
let event_source = new.unwrap;
// Handle on establishing connection
event_source.on_open;
// Fired when a message is received
event_source.on_message;
// Handle errors
event_source.on_error;
// Handle named event types
event_source.add_event_listener;
// Remove handler
event_source.remove_event_listener;
// Close Event Source
event_source.close;
Licenses
MIT or MIT/Apache 2.0 where applicable.