title: How to connect the backend to server the frontend to make realtime chatting using socket.io with different users
body: <p>I'm using Mongoose to store the chat between different registered users, at the current implementation they can retrieve chat logs if they refresh the page! which is not identical to be a real-time solution. 
  How to use socket.io() to act as sender/receiver for many users. </p>
  
  <p>I followed<br>
  <a href="https://socket.io/get-started/chat/" rel="nofollow noreferrer">https://socket.io/get-started/chat/</a> 
  and 
  <a href="https://medium.freecodecamp.org/simple-chat-application-in-node-js-using-express-mongoose-and-socket-io-ee62d94f5804" rel="nofollow noreferrer">https://medium.freecodecamp.org/simple-chat-application-in-node-js-using-express-mongoose-and-socket-io-ee62d94f5804</a></p>
  
  <p>But both, they assume the same port for the same user.</p>