CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Ajax and Design (http://www.codingforums.com/forumdisplay.php?f=55)
-   -   "open http" ajax? (http://www.codingforums.com/showthread.php?t=197360)

boeing747fp 06-02-2010 07:46 PM

"open http" ajax?
 
i know that things like meebo.com and googletalk work on open http connections via ajax so that there isnt a "refresh" or new query going on every x seconds... how is this done? i cannot find information on it from a development standpoint. any direction would be helpful

rnd me 06-02-2010 09:48 PM

it's called comet, and last time i checked, was a bit complicated.
there is no single, standardized way to do this. it's the wild west.


Comet requires both front and back end code, and different techniques work better in different browsers.

i recommend a script tag trigger and an AJAX data pipe.

you can send stuff to and request stuff from the server whenever you want, so all you really need to do is know when to do so, which requires a 2nd connection.
when something happens on that 2nd connection, you re-use the first connection to actually fetch the data, and optionally upload more. the 2nd connection should be used only to trigger.

if you try to push data through your 2nd connection, you will find a lot of cross-browser headaches.

boeing747fp 06-02-2010 10:24 PM

is it possible to just have AJAX query my red5 server? or would that have to go through flash?

rnd me 06-02-2010 10:31 PM

Quote:

Originally Posted by boeing747fp (Post 961103)
is it possible to just have AJAX query my red5 server? or would that have to go through flash?

yes, you can do it with ajax for both connections.
i would still use a dummy event connection, a regular ajax callback can dispatch the data update fetch. if you leave the 2nd connection open, the call back won't fire until the connection is closed by the server.

boeing747fp 06-02-2010 10:46 PM

well i have Fiddler installed and watched activity for meebo.com and there are no 2 connections. theres just 1 open connection that doesnt ever get to status 200....

rnd me 06-03-2010 06:36 AM

Quote:

Originally Posted by boeing747fp (Post 961109)
well i have Fiddler installed and watched activity for meebo.com and there are no 2 connections. theres just 1 open connection that doesnt ever get to status 200....

that's correct. i didn't extensively explain comet, and there are differing techniques on how to do it.

with the "dual connection" method i refer to, you actually only have one connection open at any given time. the 2 connection refer to the roles of xmlHtttpRequest objects or dynamic script tags.

the delayed-close connection stays open waiting for new data. when that data arrives, that long-open connection closes, signaling the availability of new data. that new data is downloaded via the other connection.

if meebo has figured a way to reliably trickle data through the signal pipe, i wouldn't be surprised. the last time i tried the "single pipe" approach, i hit severe xbrowser problems. it could be better now.

i think there might even be turn-key commercial comet packages available.

boeing747fp 06-03-2010 07:03 AM

im trying this one out and it isnt working yet
http://sourceforge.net/projects/comet/

boeing747fp 06-16-2010 06:31 AM

ok i am using comet successfully for chatting but it keeps the "loading" circles/cursors going even after the page is loaded... i tried it with iframes too and that didnt change anything... how do i fix this?

http://www.zeitoun.net/articles/comet_and_php/start

this is the method i am using except in php i changed it to use Memcache instead of text files...


All times are GMT +1. The time now is 02:50 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.