DEV Community

Akash Singh
Akash Singh

Posted on

Typing User Indicator (Bug Fixes and Optimization)

I started out passing typing user IDs in a HashSet but this caused issues when dealing with multiple users in varying chat rooms. Despite the efforts, the data structure could not effectively manage typing states for different rooms, leading to problems like not tracking users correctly.

Where I used HashMaps instead, where the key was the room ID, and the value was a HashSet of user IDs typing in that room. Further That's the neatest: it organizes the code better, and reception of the typing indicators will be shown for each chat room.

Due to this update, the method of tracking the typing activity becomes more reliable and makes it a much better experience for users while eliminating any bugs experienced before. The new structure not only increased performance by minimizing checks that do not need to be done and kept typing data in memory per room, making the application more scalable and stable.

Top comments (0)