Bug Description
The active contacts feature is not working as expected when a user connects through Socket.IO. The issue appears to be related to the getActiveContacts() function and its integration within the connection handler.
Current Behavior
- Active contacts are not being fetched or updated correctly.
- Users may not see all previously interacted contacts.
- Socket connection flow may be affected due to incorrect placement of the active contacts logic.
Expected Behavior
- When a user connects, all unique contacts with whom they have exchanged messages should be fetched successfully.
- The active contacts list should be updated and emitted to the client.
Steps to Reproduce
- Start the application.
- Log in with a user account.
- Open conversations with multiple users.
- Reconnect or refresh the application.
- Observe that active contacts are not loaded or updated properly.
Possible Cause
The getActiveContacts() function may be declared inside the Socket.IO connection handler or may not be invoked correctly after connection establishment.
Suggested Fix
- Move
getActiveContacts() outside the connection handler.
- Fetch active contacts after successful authentication.
- Emit the active contacts list to the connected user.
Bug Description
The active contacts feature is not working as expected when a user connects through Socket.IO. The issue appears to be related to the
getActiveContacts()function and its integration within the connection handler.Current Behavior
Expected Behavior
Steps to Reproduce
Possible Cause
The
getActiveContacts()function may be declared inside the Socket.IO connection handler or may not be invoked correctly after connection establishment.Suggested Fix
getActiveContacts()outside the connection handler.