Package su.onno.ui.presence
Class PresenceController
java.lang.Object
su.onno.ui.presence.PresenceController
Route-level presence: tracks which signed-in users are currently on each route — a record, an entity
list, or any other page (dashboards, custom pages) — so the UI can show collaboration markers ("Ada
and Babbage are also here") on the open tab, list rows, and the sidebar nav.
The client posts the pane's route path; the server derives the presence identity from it. A
catalogs/documents route is gated on the owning entity's read access (so you
only register on, and learn about, records/lists you may read), while any other route is a page
visible to any signed-in user. Identity is stamped from the authenticated principal via
CurrentUserResolver, so the client never asserts who it is. The client posts enter on
open, heartbeat periodically, and leave on close; the response returns the route's
current viewers plus you, the caller's own id, so the client can omit itself.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe heartbeat body: the pane's routepathand anaction(enter/heartbeat/leave). -
Constructor Summary
ConstructorsConstructorDescriptionPresenceController(PresenceRegistry registry, UiAccessService access, CurrentUserResolver currentUser, CommentAuthorAvatars authorAvatars) -
Method Summary
Modifier and TypeMethodDescriptionping(PresenceController.PresenceRequest request, Principal principal) The ambient-presence snapshot: every route currently being viewed, as{kind, name, id, viewers}, plus the caller's own id (you).
-
Constructor Details
-
PresenceController
public PresenceController(PresenceRegistry registry, UiAccessService access, CurrentUserResolver currentUser, CommentAuthorAvatars authorAvatars)
-
-
Method Details
-
ping
@PostMapping public Map<String,Object> ping(@RequestBody(required=false) PresenceController.PresenceRequest request, Principal principal) -
snapshot
The ambient-presence snapshot: every route currently being viewed, as{kind, name, id, viewers}, plus the caller's own id (you). The client loads this once, then keeps it current from the livepresenceSSE deltas. Entity routes are filtered to those the caller may read (you never learn that someone is viewing a record/list in an entity you can't open); page routes are visible to any signed-in user.
-