Skip to content

Add real-time rental notifications via WebSockets - #159

Open
rberrelleza wants to merge 4 commits into
mainfrom
ws-rentals
Open

Add real-time rental notifications via WebSockets#159
rberrelleza wants to merge 4 commits into
mainfrom
ws-rentals

Conversation

@rberrelleza

Copy link
Copy Markdown
Member

Summary

  • API (Go): WebSocket hub at /api/ws and internal /internal/notify endpoint for receiving events from the worker; server-side pings keep connections alive through nginx timeouts
  • Worker (Go): After each rental is persisted to PostgreSQL, POSTs the movie ID to the API's notify endpoint
  • Frontend (React): Connects WebSocket on mount with auto-reconnect, shows slide-in toast notification in the bottom-right corner when a rental completes
  • Infra: API ingress routes /api/ws with extended timeout annotations; webpack dev proxy forwards /api/ws with WebSocket support

Also fixes frontend Docker build caching so source changes are always picked up.

Test plan

  • Open the app at the deployed URL
  • Click Rent on a movie — toast notification appears in bottom-right: "<Movie Title>" rented successfully!
  • Notification auto-dismisses after 4 seconds
  • Connection auto-reconnects if dropped (check browser devtools Network tab)

🤖 Generated with Claude Code

rberrelleza and others added 4 commits April 20, 2026 14:50
- API: WebSocket hub with /api/ws endpoint and /internal/notify for worker events
- Worker: POST to API after each rental is persisted to PostgreSQL
- Frontend: Connect WebSocket, show toast notification on rental completion
- Ingress: Route /api/ws to API with extended timeout annotations

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant