I am creating a one to one chat application.
Is it a good idea to store information like online ,istyping status in session.
Why do you want to store it in session? Session is private and specific to the connection. Another user won’t be able to see the value of other user’s session.
You can save it as an array field of the chatroom. For every user typing, add the user to the array. Remove when done
Thanks @rjdavid for reply.I am relatively new to Meteor.I read more about session and realize that it is not required for this use case.Can you suggest any tips on how to design a scalable one to one chat app
For one-to-one chat, if you are going to create a document pointing to specific user A and user B, I suggest to add a field like currentlyTyping
which must be an array. The use $addToSet
and $pull
in mongoDB to easily add or remove whoever is typing
Then you must use the reactive feature of Meteor to check if someone is currentlyTyping and it is not the current user.