Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-02-2010, 07:46 PM   PM User | #1
boeing747fp
Regular Coder

 
Join Date: Oct 2003
Posts: 599
Thanks: 1
Thanked 1 Time in 1 Post
boeing747fp is an unknown quantity at this point
"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
boeing747fp is offline   Reply With Quote
Old 06-02-2010, 09:48 PM   PM User | #2
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,462
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
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.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Old 06-02-2010, 10:24 PM   PM User | #3
boeing747fp
Regular Coder

 
Join Date: Oct 2003
Posts: 599
Thanks: 1
Thanked 1 Time in 1 Post
boeing747fp is an unknown quantity at this point
is it possible to just have AJAX query my red5 server? or would that have to go through flash?
boeing747fp is offline   Reply With Quote
Old 06-02-2010, 10:31 PM   PM User | #4
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,462
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Quote:
Originally Posted by boeing747fp View Post
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.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Old 06-02-2010, 10:46 PM   PM User | #5
boeing747fp
Regular Coder

 
Join Date: Oct 2003
Posts: 599
Thanks: 1
Thanked 1 Time in 1 Post
boeing747fp is an unknown quantity at this point
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....
boeing747fp is offline   Reply With Quote
Old 06-03-2010, 06:36 AM   PM User | #6
rnd me
Senior Coder

 
rnd me's Avatar
 
Join Date: Jun 2007
Location: Urbana
Posts: 3,462
Thanks: 9
Thanked 466 Times in 450 Posts
rnd me is a jewel in the roughrnd me is a jewel in the roughrnd me is a jewel in the rough
Quote:
Originally Posted by boeing747fp View Post
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.
__________________
my site (updated 5/13)
STATS (2013/5) HTML5:90.2% MOB:14% IE7:0.5% IE8:8.6% IE9:9.8% IE10:10%
rnd me is offline   Reply With Quote
Old 06-03-2010, 07:03 AM   PM User | #7
boeing747fp
Regular Coder

 
Join Date: Oct 2003
Posts: 599
Thanks: 1
Thanked 1 Time in 1 Post
boeing747fp is an unknown quantity at this point
im trying this one out and it isnt working yet
http://sourceforge.net/projects/comet/
boeing747fp is offline   Reply With Quote
Old 06-16-2010, 06:31 AM   PM User | #8
boeing747fp
Regular Coder

 
Join Date: Oct 2003
Posts: 599
Thanks: 1
Thanked 1 Time in 1 Post
boeing747fp is an unknown quantity at this point
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...
boeing747fp is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:25 AM.


Advertisement
Log in to turn off these ads.