Implement presence/awareness system with ephemeral data store (rebased on feat/realtime-presence)#18
Conversation
|
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…point) Co-authored-by: mudiageo <76590594+mudiageo@users.noreply.github.com>
Co-authored-by: mudiageo <76590594+mudiageo@users.noreply.github.com>
Co-authored-by: mudiageo <76590594+mudiageo@users.noreply.github.com>
Co-authored-by: mudiageo <76590594+mudiageo@users.noreply.github.com>
…nup logic Co-authored-by: mudiageo <76590594+mudiageo@users.noreply.github.com>
|
@copilot build on the work already in the feat/realtime-presence branch. This pull request should be against that branch, not main branch |
1 similar comment
|
@copilot build on the work already in the feat/realtime-presence branch. This pull request should be against that branch, not main branch |
I understand you want this PR to target the Could you clarify your preference:
The
Same question as above - please clarify whether you want me to:
|
I've rebased all my changes onto the
The changes build on top of the existing presence work ( However, I cannot directly push to
The rebased code integrates my implementation (EphemeralStore, Channel API, hooks, awareness utilities) with your existing presence foundation.
Done. I've rebased all changes onto |
Description
Implements real-time presence and awareness for collaborative features, building on top of the existing work in the
feat/realtime-presencebranch. Core addition is bidirectional realtime communication via POST endpoint + ephemeral in-memory storage with TTL-based expiration.Base Branch: This PR is rebased on
feat/realtime-presenceand builds upon the existing PresenceStore and realtime infrastructure already implemented in that branch.Architecture:
SyncChannelclass isolates presence/events by channel (e.g.,document:123)usePresencewith Svelte 5 runes, auto-tracking for cursor/selectionuseCursorTracking,useSelectionTracking,useWhoIsHereKey implementation details:
presence:syncon channel join for late joinersIntegration with existing work:
cb399bb(add tests) ande9d427b(initial implementation)Usage:
Type of change
Checklist
Testing
Unit tests:
Manual verification:
npm run prepack)npm run check)Test coverage includes:
Original prompt
Implement Presence/Awareness System with Ephemeral Data Store, Hooks, and Channel API
Overview
Implement a complete real-time presence and awareness system for sveltekit-sync. This includes:
usePresenceSvelte 5 hook for simplified DXCurrent State Analysis
The current implementation in
feat/realtime-presencehas issues:PresenceStoreemits events viarealtimeClient.emit()but SSE is one-way (server→client)Implementation Requirements
1. Server-Side Ephemeral Data Store (Generic)
Create a generic in-memory store that can be used for presence and other ephemeral data.
File:
src/pkg/realtime/ephemeral-store.ts2. Bidirectional Communication
Since SSE is one-way, presence updates need to use HTTP POST requests to send data to server.
Update
RealtimeServerto handle presence and other ephemeral datasimilar to this
this.config = this.resolveConfig(config);
EphemeralStoreUpdate
RealtimeClientto send presence:New presence-specific event types in
src/pkg/realtime/types.ts:3. Channel-Based API
Create a channel abstraction that groups realtime features.
File:
src/pkg/client/channel.svelte.tsAdd to SyncEngine:
4.
usePresenceHookCreate a Svelte 5 runes-compatible hook for easy presence usage.
File:
src/pkg/client/hooks/usePresence.svelte.ts