implementing a AJAX chat site
Question
I want to implement a chat site with following features:
- Direct one-on-one chat with a randomly picked stranger
- If my conversation partner gets disconnected, I should be shifted to different stranger
In short, I want to imitate http://omegle.com/
Which language is best suited to this task? Jsp and Java? PHP? ASP? Others?
Should all of the messages go through the web server, or is there a better approach?
Solution
You may want to look into Google Web Toolkit (GWT). Ryan Dewsbury's book "Google Web Toolkit Applications" actually runs you through the process of writing a basic chat application.
GWT lets you write Java code that is compiled into Javascript for AJAX applications.
OTHER TIPS
I wrote an AJAX Chat tutorial years ago at:
http://www.dynamicajax.com/fr/AJAX_Driven_Web_Chat-271_290_291.html
I also did a JSON version of it too:
http://www.dynamicajax.com/fr/JSON_AJAX_Web_Chat-271_290_324.html
Those are written in PHP but the back end is really simple so you can port it to whatever language you want easily. Here's a version that I converted to ASP.NET
http://www.dynamicajax.com/fr/AJAX_Web_Chat_ASP_NET-271_290_328.html
It works pretty much like Omegle, all you need to do is setup the code to randomly select a stranger.
I recently created a chat script using PHP + AJAX. Yes, all of my chat messages went through the server because it used AJAX and server-side PHP scripting to deliver the messages to the recipient(s).
For an example of a PHP chat script, see: http://www.phpfreechat.net/