Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Oct 2003
    Posts
    603
    Thanks
    2
    Thanked 1 Time in 1 Post

    "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

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,296
    Thanks
    10
    Thanked 583 Times in 564 Posts
    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 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #3
    Regular Coder
    Join Date
    Oct 2003
    Posts
    603
    Thanks
    2
    Thanked 1 Time in 1 Post
    is it possible to just have AJAX query my red5 server? or would that have to go through flash?

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,296
    Thanks
    10
    Thanked 583 Times in 564 Posts
    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 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #5
    Regular Coder
    Join Date
    Oct 2003
    Posts
    603
    Thanks
    2
    Thanked 1 Time in 1 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....

  • #6
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,296
    Thanks
    10
    Thanked 583 Times in 564 Posts
    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 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%

  • #7
    Regular Coder
    Join Date
    Oct 2003
    Posts
    603
    Thanks
    2
    Thanked 1 Time in 1 Post
    im trying this one out and it isnt working yet
    http://sourceforge.net/projects/comet/

  • #8
    Regular Coder
    Join Date
    Oct 2003
    Posts
    603
    Thanks
    2
    Thanked 1 Time in 1 Post
    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...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •