Friday, January 30th, 2009

w00t! Feeling Chatty

Category: Aptana, JavaScript, jQuery, Showcase

>

Live Ajax chat is one of those Comet 101 kind of examples (as RSS readers were to Ajax back in the day!).

We saw a couple of items from this meme recently.

First, jChat, a showcase chat application using Jaxer:

Jaxer ships with a number of basic samples, but I’ve seen quite a few people online in search of more complex examples and specifically ones that make use of the new ActiveRecord.js library. The extended example I developed is called jChat. jChat is fully functional chatroom application that demonstrates integration of the following web related technologies; HTML, CSS, JavaScript, MySQL, YUI, Jaxer, and Activerecord.js.

jChat’s DOM access/manipulation, event handling, and animation code makes heavy use of YUI. The YUI Library is a set of utilities and controls, written in JavaScript, for building richly interactive web applications using techniques such as DOM scripting, DHTML and AJAX.

Then we get to Red tag crazy (or w00t! for girls) who told us about their live chat implementation in the wild:

We wanted this to be really fun for our shoppers, and chicks like to chat. Then came the idea, “what if we have a chat system right on our home page?”. The pre-requisites were: it has to be super easy to use, not require any sign-up, no plugins, and it has to support thousands of users at once. Solution = jQuery Ajax.

Our server crashed on day 2 from the memory used by PHP to refresh hundreds of ajax clients at once. Our solution was to cache a single JavaScript file that is loaded via ajax by each client every 15 seconds. This file contains all the necessary data to update a page with a bunch of chat bubbles and slide in new comments as if it were some sort of crazy java plugin. PHP runs via cron-job to update this cached JS/jQuery powered file every 2 seconds on our server, which turns out to be a lot less memory intensive than at every ajax request.

Related Content:

Posted by Dion Almaer at 5:16 am
8 Comments

+++--
3.4 rating from 30 votes

8 Comments »

Comments feed TrackBack URI

Looks great, tobad the chat server is dead

Comment by V1 — January 30, 2009

Re: RedTagCrazy’s “chick chat” – Loading a static JS file every 15 seconds is not Comet, it’s just old-school polling.

Also, has anyone actually gotten that RedTagCrazy.com chat to work? The “chick chat” link doesn’t do anything for me. (… maybe ’cause I’m not a chick?)

Comment by broofa — January 30, 2009

This uses a ‘real’ comet, and Google Translate to convert incoming chat messages into a native language.
.
http://archive.dojotoolkit.org/nightly/dojotoolkit/demos/babelChat/demo.html
.
horribly styled [but functional] prototype. Fun to see the translations sometimes.

Comment by phiggins — January 30, 2009

http://meebo.com ?

Comment by whyisjasontaken — January 30, 2009

I thought Polling was “bad”? Kinda like “crossing the streams”. Aren’t we trying to get away from this and use a comet-style approach.

Comment by frio80 — January 30, 2009

ClockingIT has a comet chat modeled after the Facebook chat. Took me a whole weekend to implement so it’s a wonder why more sites aren’t including a custom real-time chat.

Comment by Fudgie — January 30, 2009

“Comet is a neologism to describe a web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it.”

i’m not a big pro of “comet style” but i’m building a comet chat based on memcache, i think the two examples of this post doesn’t belong to “comet programming”.

they just make ajax calls at xx ms intervals and i think this is not comet style programming…

am i wrong ? :)

Comment by vinsant — January 30, 2009

Looks great, tobad the chat server is dead

Comment by taheal123 — September 18, 2009

Leave a comment

You must be logged in to post a comment.