is it ok to store to use a user unique id as a Session_id in LocalStorage ?
I am working on a chat application I wanted to send online friends to the current user what i plan to do is to fetch the user friends from the database I have a socket server everytime the user logs in an object will be added to the map the object contains user info such as the username , email, etc.. I am thinking of having the UniqueId of each user object in the map as the key the reason is i believe it will be easier and faster to map online friends to the friends array returned to the client-side of my app that way instead of having some other id as the key then I'll need to loop to find which of the users in the map are user friends and then determine their connection status , if i have a lot of users the loop will be very big and it will take a lot of time performance wise i don't think it's a good idea by using the UniqueId i can have a list of UUID yes there will be a loop but it will much smaller then use that UniqueId list to find which of the users in the map are the logged user friends , each user will have a session the session will be stored in LocalStorage i am not sure if it's a good idea to store the session in the localStorage with the user unique id as it's key instead of some other randomly generated id
0 Replies