docs: add architecture and implementation documentation for SSE integ… - #1354
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1300
Description
Corrects the SSE architecture diagrams and documentation in
SSE_ARCHITECTURE.mdandSSE_IMPLEMENTATION.md. The previous diagrams and prose incorrectly showed HTTP API controllers (e.g.,Stream Controller) invokingsseService.broadcast()synchronously upon receiving user actions. In reality, all stream/protocol SSE events originate asynchronously from the background indexer worker (SorobanEventWorker) only after transaction confirmation on the Stellar ledger, with computed runway alerts emitted byStreamRunwayWorker.Type of Change
Related Issues
Closes #
Changes Made
backend/docs/SSE_ARCHITECTURE.mdto show event flow originating from Stellar/Soroban ledger executions toSorobanEventWorker(Indexer), which persists state and dispatchessseService.broadcastToStream/Admin().stream.controller.ts,sse.controller.ts) do not trigger broadcasts directly and that SSE events are delayed/indexer-driven after on-chain confirmation.sseService.broadcastToAdmin()to the Event Broadcasting Logic section alongsidebroadcastToStream()andbroadcastToUser().backend/docs/SSE_IMPLEMENTATION.mdto reflectSorobanEventWorker/ indexer instead of stream controller.Testing
Test Coverage
Test Steps
sseService.broadcast*call sites acrossbackend/src/(soroban-event-worker.ts,stream-runway-worker.ts,sse.service.ts) against the updated documentation.backend/docs/SSE_ARCHITECTURE.mdandbackend/docs/SSE_IMPLEMENTATION.md.Breaking Changes
None.
Screenshots/Demo
N/A (Documentation update).
Checklist
Additional Notes
This update prevents confusion when debugging stream lifecycle events (e.g., pause, withdraw, top-up, cancel) where SSE events appear with ledger latency rather than synchronously upon HTTP API invocation.