Answer the question
In order to leave comments, you need to log in
How to write an anonymous chat or create rooms for 2 people?
Hello, this is already my second question on the toaster. I made a chat, the client part is written in JavaScript, and the server part is written in Python. The essence of my project is an anonymous chat. The essence of the site will be as follows: you go to the site, choose your gender, then the gender of the interlocutor. And then, 'Searching' is displayed, and according to the idea, the system should create a room for 2 people and connect people. I tried, tried more than once to think over the algorithm. I tried to assign criteria to the client, but it all came down to one thing, he would turn to you for help. I sincerely hope for your help, because. can you give advice that will help me :) I already have a chat ready, from which I make anonymous) Just in case. Here is a link to the chat, put it on a temporary domain for the test:
- 5.101.115.43 ( Not advertising, it's on VDS )
Thanks in advance :)
Answer the question
In order to leave comments, you need to log in
Regular WebSocket will help you. (for anonymity) and search make a list of clients who are looking for a room. Then we save the id of the interlocutors to the local storage on both sides. Then they send messages to each other through your socket server.
Assign those who are looking for the variable search = true, then create a separate array with those whose search is true, and then just randomly select two and connect them.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question