Implement one-to-one real-time chat using Socket.IO#1382
Implement one-to-one real-time chat using Socket.IO#1382gaurav123-4 wants to merge 3 commits intocode-a2z:mainfrom
Conversation
|
@gaurav123-4 is attempting to deploy a commit to the avdheshvarshney's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for submitting your pull request! We'll review it as soon as possible. For further communication, join our discord server https://discord.gg/tSqtvHUJzE. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@gaurav123-4 Please check your FE deployment has failed. |
Avdhesh-Varshney
left a comment
There was a problem hiding this comment.
@gaurav123-4 Great Work.
Display all the registered users but on later will display the status on user on avatar like a green dot (for online users) otherwise empty dot (for offline users).
Please share me a working demo video of this whole current state of the feature.
| @@ -0,0 +1,4 @@ | |||
| export const CHATS_SIDEBAR_WIDTH = 280; | |||
There was a problem hiding this comment.
Increase width to 300px
There was a problem hiding this comment.
Remove changes from this file
|
@gaurav123-4 You have forget to remove the lock from this icon. |
|
@Avdhesh-Varshney I am working on the changes you told above and will be completed by today . |
|
@Avdhesh-Varshney Please check after the changes |
|
#1384 Both are same. So, closing this PR |
|
@Avdhesh-Varshney This PR is from the different branch but after pushing the 1st one i push the code in other branch please don't close . You can tell me a small change i will do that and in this same PR i will push the changes |
|
@gaurav123-4 Don't worry on closing of this PR. I've mentioned your same changes are present in your's another branch. To do new changes, Try to improve your implemented feature chatting so everyone will use it. |


Pull Requests Review Criteria
Caution
PRs that fail to meet these review standards will be automatically flagged and may be rejected by maintainers.
mainCloses: #1380
Describe the add-ons or changes you've made 📃
Implementation Summary
Files Created/Updated:
Database Schema & Model:
src/schemas/message.schema.js - Message schema with sender/receiver, read status, and indexes
src/models/message.model.js - Message model
Updated src/constants/db.js - Added MESSAGES collection
Socket.IO Server:
src/config/socket.io.js - Socket.IO server with:
JWT authentication middleware
Connection management
Real-time event handlers
REST API Controllers:
src/controllers/chat/get-messages.js - Get conversation messages
src/controllers/chat/get-conversations.js - Get list of conversations
Routes:
Updated src/routes/api/chat.routes.js - Added endpoints for messages and conversations
Server Integration:
Updated index.js - Initialize Socket.IO with HTTP server
Updated src/stores/online-users.js - Added removePresence function
Updated package.json - Added socket.io dependency
Socket.IO Events:
Client → Server:
message:send - Send a message to another user
typing:start - Indicate user is typing
typing:stop - Stop typing indicator
message:read - Mark messages as read
Server → Client:
message:sent - Confirmation message was sent
message:receive - Receive a new message
message:read - Notification that messages were read
typing:start - User started typing
typing:stop - User stopped typing
user:online - User came online
user:offline - User went offline
message:error - Error occurred
REST API Endpoints:
GET /api/chat/conversations - Get all conversations for current user
GET /api/chat/messages/:userId - Get messages with a specific user (supports pagination)
Screenshots 📷
Note to reviewers (Optional) 📄