Skip to content

feat: add real-time updates via SSE (Server-Sent Events)#26

Merged
asim merged 1 commit intomasterfrom
feature/sse-realtime
Jan 27, 2026
Merged

feat: add real-time updates via SSE (Server-Sent Events)#26
asim merged 1 commit intomasterfrom
feature/sse-realtime

Conversation

@asim
Copy link
Member

@asim asim commented Jan 27, 2026

Summary

This PR adds real-time functionality to the blog, so pages update automatically when content changes without requiring users to refresh.

Changes

Backend

  • New 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
  • Automatic reconnection on disconnect

Features

  • 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

Architecture

Browser (EventSource) <--SSE-- Web Service <--Broker-- Posts/Comments Services

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

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>
@asim asim merged commit 8a05818 into master Jan 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants