Skip to content

Active Contacts Not Updating Correctly on Socket Connection #570

Description

@adityayadav176

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

  1. Start the application.
  2. Log in with a user account.
  3. Open conversations with multiple users.
  4. Reconnect or refresh the application.
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions