A full-stack bidirectional messaging platform powered by Socket.io WebSockets, supporting private 1-on-1 chats and multi-user group rooms with persistent message storage in MongoDB.
This application implements full-duplex, event-driven communication using the Socket.io library on top of WebSockets. The architecture supports both private (1-to-1) and group room messaging, with each room being isolated in its own Socket.io namespace.
All messages are persisted in MongoDB, so chat history is available across sessions. The React frontend renders chat threads in real time using optimistic UI updates — messages appear instantly in the sender's UI before server acknowledgment.
send_message → { roomId, content, senderId }
receive_message → broadcast to room members
typing → { roomId, userId } (debounced 300ms)
message_saved → persist to MongoDB + confirm to sender
user_disconnected → update presence, notify room