Page 1 of 1

Worth learning Comet (reverse AJAX) techniques?

Posted: Fri Oct 29, 2010 5:21 am
by Jackolantern
I had honestly never heard of Comet techniques until the other day. To those who have never heard of it, it is also called "reverse AJAX" (the name is not an acronym as far as I know; it is just a play on "AJAX" since "Comet" is another cleaning product). It allows the web server to push updates to the browser without the browser specifically asking for it. Obviously the implications of this for browser-based games are huge. You could have real PvP that notifies players as soon as they are attacked and forces a page reload to a battle screen. You could have true real-time chat where the client would only need to send user-initiated chats, and they get all chats from others automatically, without polling or similar bandwidth-wasting techniques. You could have a real-time map that shows the movement of other players, also without polling.

However, with webSockets on the horizon, it really makes me question whether it is worth investing in this technique for something as complex as a game. Obviously webSockets would almost completely nullify the usefulness of such odd techniques as "long-held HTTP requests" and other Comet strategies. But since it seems Microsoft is going to hold off on webSockets in IE9 until a more solid, official standard for them is released, it could be quite a while before this is a reality for public internet development.

So what do you think? Does anyone know anything further about IE9 support for webSockets?

Re: Worth learning Comet (reverse AJAX) techniques?

Posted: Fri Oct 29, 2010 7:11 am
by Chris
You bet. There isn't anything better! Every use omegle? Look how fast it goes even with a few thousand users. All down to using comet techniques rather than constantly calling files from the server. I'm actually using reverse Ajax in my browser game. It's coming around December in Alpha.

And no I've been testing with IE9 and there's not much support. But there isn't much support for much Ajax yet either.

Edit: Just got my hands on a newer IE9. Yes! There's support :D.

Re: Worth learning Comet (reverse AJAX) techniques?

Posted: Fri Oct 29, 2010 1:20 pm
by Chris
Here's a chat I was working on. Didn't know I had it on my laptop. Thought I lost it with all my other stuff when my brother decided my computers hard drive needed to be formatted.

Here's a link:
http://chrishemmens.com/shoutbox/

You may notice the debug at the bottom.

How it works is, the client asks the server for a response. The server keeps checking the chat file if it's been updated. If it's been updated. The server sends to the client the new data. Then it all starts again.

Re: Worth learning Comet (reverse AJAX) techniques?

Posted: Fri Oct 29, 2010 3:20 pm
by Chris
Quick flowchart I put together
Image

Shows you basically how it works.

Re: Worth learning Comet (reverse AJAX) techniques?

Posted: Fri Oct 29, 2010 5:01 pm
by Jackolantern
Wow, thanks! I definitely think I am going to check in on this then. This could really help to streamline a game! Again, thanks for all the info!

Re: Worth learning Comet (reverse AJAX) techniques?

Posted: Fri Oct 29, 2010 9:47 pm
by Chris
K, I've been working with the chat script a bit more. And have found out that using GET instead of POST saves a lot of loading time. I'm going to tweak it even moar, to see how fast I can get it to go. Keep in mind this is running off a slow overused server.

Re: Worth learning Comet (reverse AJAX) techniques?

Posted: Sat Oct 30, 2010 1:36 am
by Jackolantern
It worked for me just as fast as any other straight AJAX chatboxes I have ever seen.

Re: Worth learning Comet (reverse AJAX) techniques?

Posted: Sun Oct 31, 2010 8:41 am
by tomtefan
Curious to see what kinda chat thingy your working on chris. :D

Iam looking for a chatbox / shoutbox for my game.
So i tried to enter your site chris, but it seems to be down ??

Iam not looking for anything fancy or such, just a little box where players can type stuff.
And is it not best to use a chat that only updates/refreshes when ever a player says anything,
rather than querying at say every 1 - 5 sec wich i have seen some uses.

Re: Worth learning Comet (reverse AJAX) techniques?

Posted: Sun Oct 31, 2010 12:33 pm
by dave3460
Hey chris may be pushing my luck but is it possible to see the js as well

cheers dave

Re: Worth learning Comet (reverse AJAX) techniques?

Posted: Sun Oct 31, 2010 1:26 pm
by Torniquet
certainly sounds the way forward :D

got any links to decent tutorials on using said methods??