Ajax chat system - Active HTTP connection?

Discussion in 'Javascript' started by jason.m.ho@gmail.com, Sep 17, 2006.

  1. Guest

    Hello!
    I am trying to build an ajax chat system. Currently I have it so that
    when you chat, you upload your message to the database, and each client
    is polling that database to see if he/she has any new messages. The
    problem with this is that I poll at 2 second intervals (since
    connection is not active), and so its not as responsive as I'd like it
    to be.

    My question is, is an active HTTP connection possible? How did Meebo or
    Gmail implement their ajax chat? Can someone point me to a better tool
    for implementing an active-connection chat, rather than a poll-based
    one?

    Thank You!
    - Jason
     
    , Sep 17, 2006
    #1
    1. Advertising

  2. Tom Cole Guest

    wrote:
    > Hello!
    > I am trying to build an ajax chat system. Currently I have it so that
    > when you chat, you upload your message to the database, and each client
    > is polling that database to see if he/she has any new messages. The
    > problem with this is that I poll at 2 second intervals (since
    > connection is not active), and so its not as responsive as I'd like it
    > to be.
    >
    > My question is, is an active HTTP connection possible? How did Meebo or
    > Gmail implement their ajax chat? Can someone point me to a better tool
    > for implementing an active-connection chat, rather than a poll-based
    > one?


    There is no alternative in javascript that I'm aware of. Plus HTTP (the
    delivery protocol) is not designed for those types of communication.

    You can, however, utilize two XmlHttpRequests at the same time. One
    that strictly sends new posts up to the server and one that constantly
    polls for updates. You could shorten the time on the polling request.
    Just make sure your server can handle the volume of requests from
    however many clients you expect to have running.

    That or write your client and server using some other language than
    javascript and using a protocol than HTTP.

    >
    > Thank You!
    > - Jason
     
    Tom Cole, Sep 17, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luiz Alberto Gibson da Costa

    web chat development, http header connection: keep-alive

    Luiz Alberto Gibson da Costa, Aug 6, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    611
    Luiz Alberto Gibson da Costa
    Aug 6, 2003
  2. Replies:
    0
    Views:
    2,203
  3. Replies:
    0
    Views:
    560
  4. Replies:
    1
    Views:
    139
  5. campos

    Active time for HTTP connection

    campos, Nov 16, 2007, in forum: Javascript
    Replies:
    5
    Views:
    155
    Thomas 'PointedEars' Lahn
    Nov 18, 2007
Loading...

Share This Page