feat: add real-time updates via SSE (Server-Sent Events)#26
Merged
Conversation
This adds real-time functionality to the blog, so pages update automatically when content changes without requiring users to refresh. Changes: - Add events package for publishing blog events (posts/comments CRUD) - Posts service publishes events on create/update/delete - Comments service publishes events on create/delete - Web service includes SSE endpoint at /events - Frontend JavaScript connects via EventSource for live updates - CSS animations for new/updated/deleted content - Notification toasts for new posts The implementation uses go-micro's broker for pub/sub, which works with the default HTTP broker locally and can use NATS in production. Frontend features: - Automatic reconnection on disconnect - New posts appear at top of feed with animation - Updated posts flash to indicate changes - Deleted posts fade out - New comments appear in real-time on post pages - Toast notifications for new content This addresses the real-time requirements discussed in micro/go-micro#2788 Co-authored-by: Shelley <shelley@exe.dev>
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.
Summary
This PR adds real-time functionality to the blog, so pages update automatically when content changes without requiring users to refresh.
Changes
Backend
eventspackage for publishing blog events (posts/comments CRUD)/eventsFrontend
EventSourcefor live updatesFeatures
Architecture
The implementation uses go-micro broker for pub/sub, which works with the default HTTP broker locally and can use NATS in production.
Related
This demonstrates the SSE support added in micro/go-micro#2825, addressing the real-time requirements discussed in micro/go-micro#2788