Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing a random chat among people

My idea is to make a website, where people could registry and search for a people to talk. They can choose people from certain country, genre, with certain age and so on.

Yeah, I know there is a lot of websites like this, but I want to implement this, because it looks really challenging.

Can you give me ideas how could I implement this using PHP + MYSQL + Jquery(Ajax)? I am neither a beginner nor advanced with these things.

So, how should this work? One person clicks search button, this person is put in database that he searches for somebody to talk, so what's next? I also want to be able to allow people to talk with a few people at the same moment.

I am not asking for a code or something, just ideas how to code it, no code needed.

Thank you.

like image 743
good_evening Avatar asked Oct 04 '10 16:10

good_evening


3 Answers

I don't think that a synchronous, blocking programming language like PHP is the right platform for such an application. It were much wiser to choose an asynchronous, non-blocking language like JavaScript. This has the great advantage that you may use Long Polling which will improve the chatting experience in your application.

Thus I recommend implementing this using NodeJS. You may want to look at an implementation of a simple chat in node.

like image 158
NikiC Avatar answered Nov 08 '22 00:11

NikiC


Make a bucket for each organizational unit (Country, Genre, Age, etc.).

When a use connects, give them an incrementally larger index for each bucket they belong to.

When a user wants to connect with somebody from a bucket, simply generate a new random number between 0 and the max index value for the bucket...and connect them!

like image 4
Justin Niessner Avatar answered Nov 07 '22 22:11

Justin Niessner


I believe using PHP+MySQL is fine. I suggest you to use push services to make the chatting environment even better. With push, your client doesn't have to request the server to get new data + it makes the chatting real-time. Some of push services are: PusherApp, Kwwika, Hookbox and BeaconPush. They have great support, documentation and libraries. Good luck.

like image 2
Nam Ngo Avatar answered Nov 08 '22 00:11

Nam Ngo