Umbral
Back to plugin directory
UR

Umbral Realtime

Official by Umbral contributors

SSE/WebSocket push, rooms, user targets, presence

official beta

About

Polling is the sound of a UI that doesn't trust the server to tell it anything. Umbral Realtime pushes instead: target a single user or a whole room, and let an ORM post_save signal fan a change out to everyone watching — a new comment appears, a dashboard counter ticks, a moderation queue lights up — without the browser asking "anything yet?" every two seconds. A default connection cap and per-connection message-rate cap keep one client from flooding the server.

Install

cargo add umbral-realtime

Wire it up

Hang a handler off a model's lifecycle and push when it fires.

use umbral::prelude::*;
use umbral_realtime::{RealtimePlugin, ModelEvent, ModelAction};

let app = App::builder()
    .database("default", pool)
    .plugin(
        RealtimePlugin::default()
            .on_model::<Comment, _, _>(|ev: ModelEvent| async move {
                if ev.action == ModelAction::Created {
                    // notify watchers of this thread
                }
            }),
    )
    .build()?;

Browsers subscribe over SSE at /realtime/sse.

Target: a live, superuser-only notification

Target by user id (never a public group) and only superusers ever receive the event — a normal visitor's connection is never sent it.

use umbral_realtime::Realtime;

Realtime::to_user(admin_id.to_string())
    .send("admin_notification", &payload).await;

What you get

  • Push over SSE (WebSocket on the roadmap)
  • Target a single user or a named room
  • ORM post_save signals fan out changes automatically
  • Default connection cap + per-connection message-rate cap
  • User-targeted events = private channels with no group to guess

Usage

Register `RealtimePlugin::default()` and hang `.on_model::<T, _, _>(...)` handlers off the models whose changes should push. Browsers connect at `/realtime/sse`; send to a room or to a specific user id with `Realtime::to_user(...)`.

plugin setup
cargo add umbral-realtime

Feature tracker

Per-feature shipping status, recorded in the directory.

5 of 6 shipped
SSE transport shipped Beta

Server-sent events endpoint for browser push.

WebSocket transport experimental Beta

Bidirectional socket endpoint with origin checks.

User and room targets shipped Beta

Send to one user or a named public/private group.

Model-event hooks shipped Beta

Broadcast from ORM create/update/delete lifecycle events.

Presence usable Beta

Track and publish join/leave state for rooms.

Connection and rate limits shipped Beta

Default caps protect the server from noisy clients.

Compatibility

Declared support per Umbral version and database backend.

No compatibility rows declared yet.

Community notes

0 notes in the discussion thread.

No notes yet. Be the first to share how this plugin works for you.

Reported issues

Bugs and abuse reports filed against this plugin.

Report an issue

No open issues

No issues have been reported against this plugin. Track upstream bugs on the maintainer's tracker, or report a directory problem to the Umbral team.