Skip to content
This repository was archived by the owner on Nov 9, 2025. It is now read-only.
This repository was archived by the owner on Nov 9, 2025. It is now read-only.

Realtime Messaging with WebSockets #89

Description

@flow-pie

Feature description

Integrate a realtime messaging system in the student marketplace using WebSockets.
Messages should sync instantly across clients with delivery/read status, typing indicators, and optional notifications.


Why is it needed?

  • Current delay in communication will lead to poor user experience

Issue to be solved

Right now, users have to refresh pages or wait for long polling. This will cause:

  • Missed opportunities (urgent sales like textbooks, tickets, or roommates).
  • Low trust (delayed replies feel like ghosting).
  • User churn (they default to external apps).

Any possible alternatives or similar features you’ve seen elsewhere

  • WhatsApp / Messenger → instant delivery with ticks & read receipts.
  • Discord / Slack → typing status and presence indicators.
  • Facebook Marketplace → chat tied to listings.

Technical Approach (WebSockets)

Transport Layer

  • Use WebSockets for realtime bi-directional communication.

Server-side Design

  • Maintain a WebSocket server that:
    • Handles user connections (one socket per logged-in user).
    • Manages chat rooms (one per conversation/listing).
    • Emits events: message, delivered, read, typing.
  • Store messages in a persistent database ie Postgres via supabase
  • Use Redis for horizontal scaling → sync messages across multiple servers.

Client-side Integration

  • Connect to WebSocket server on login.
  • Join relevant chat rooms when opening conversation.
  • Emit events:
    • send_message (with message payload).
    • typing (on key press).
  • Listen for:
    • new_message (render instantly).
    • delivered & read updates.

Extra Features (future-proof)

  • Push notifications for offline users (FCM for Android, Web Push for browsers).
  • Message attachments (images, docs).
  • End-to-end encryption
  • Presence indicators (online/offline).

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

Status
BackLog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions