title: Use redis to build a real time chat with socket.io and NodeJs
body: <p>I want to built a real time chat system for my project but actually I have some problems with Redis because I want my data stored as better as possible.</p>
  
  <p><strong>My problem:</strong></p>
  
  <p>I'd like to use Socket Io to do real time chatting in a closed group (of two people), but how to store messages?</p>
  
  <p>Redis is a key value store and that means that if i want to store something i need to add an unique key to my data before getting stored.</p>
  
  <p>If the same user posts more than one messages which keys would I use inside redis? I'm thinking about unique ids as unique keys but since I want to be able to fetch this comments when a user log the chat page, but if I do that I need to write another database that relate chat ids to the user that posted that message</p>
  
  <p>Am I forgetting anything? Is there a best method to do this?</p>
  
  <p>Sorry for my bad English.</p>