Reputation: 1311
I am building a new chat application with a real-time communication server. I can send and receive messages from the server. Now I need to map the the users for private real time communication. How can I get it either client side or server side?
I am getting msg from the server as follows:
msg:"blah blah", participants: [id1,id99], sessionid: "I need to create unique id for each conversation"(this id is the whole thing to maintain msgs between users),
use case
Is there anything wrong in my approach?
Please suggest what the other approaches are for building a multi-user chat application with JavaScript?
Upvotes: 0
Views: 81
Reputation: 4906
I don't know if i correctly understood your question, but how about introducing the concept of a private conversation at the back-end. Then you can store all the participants of that conversation (in your case i guess there will be only two).
This way you set the server side responsible for all the details needed to make this possible. The clients would only need to pass the message and the id of the private conversation (that will probably be store in a list of private conversations), and leave the server do all the other stuff.
Upvotes: 1