Page view counter

Chat Style app using AJAX

Last post 02-15-2007 1:28 PM by kalel. 4 replies.

Sort Posts:

  • Chat Style app using AJAX

    01-27-2007, 1:56 PM
    • Loading...
    • kevin_w_kraus
    • Joined on 02-17-2003, 7:01 PM
    • Denver
    • Posts 1
    • Points 0

    I need to understand the feasibility of building an AJAX application that allows for online presence like a chat app and allows for server to client callbacks to forward work events to the client who is logged on.

    In other words, I want to avoid a timed polling scenario by allowing a user to log into an application, have the server component manage their presence online and when work needs to be done the server would find out who is online, assign the task to them and call the users browser (using an AJAX enabled listener?) to notify the user of the work that needs to be done.

    We are talking about tens of thousands of users logged on at once, so polling every 5 seconds for work is not an option.

     

    Kevin

    thx,

    Kevin
  • Re: Chat Style app using AJAX

    01-27-2007, 3:44 PM
    • Loading...
    • Odegaard
    • Joined on 06-26-2003, 7:36 AM
    • California, USA
    • Posts 124
    • Points 219

    AJAX uses XmlHttpRequests. The problem is that HTTP protocol is a specific polling protocol and doesn't support pushing. No matter how cool ajax is, you won't get out of this limitation. You have the following workarouund:

    • Hide a Flash "proxy" control that creates an open TCP/IP connection to a server. The problem is that flash cannot use ports below 1024, so the user might not have access through their firewall.
    • Do the above using a java applet that runs on port 80. Java isn't installed on as many clients as flash though
    • Use Polling
    • Use all of the above, and automatically downgrade depending on open ports and/or availability of flash/java
  • Re: Chat Style app using AJAX

    01-28-2007, 11:33 PM
    • Loading...
    • jodywbcb
    • Joined on 03-12-2003, 3:52 PM
    • West Seattle,WA
    • Posts 985
    • Points 4,482

    here is some sample code of a chat app using Ajax from Rick Strahl's site- MS AJAX Samples updated for 1.0 Release Version

     

    Unfortantely - for the same reasons the other responder stated - server to client polling really can not be done.  What you could do is have two seperate polling requests 1. to get bit flag if work is to be done 2. if bit flag from first poll is true - then poll get the work item.  If load is an issue - you could instead of a bit flag pass the next next polling interval (which could increment or decrement according to number of users - a value of 0 would indicate - get work item. 

     

    Just a suggestion...

    -- jody
    My Blogs on .Net 2.0 and Ajax
    http://csk.wbcb.com
    http://ArtbyJody.com
  • Re: Chat Style app using AJAX

    02-15-2007, 1:15 PM
    • Loading...
    • kalel
    • Joined on 05-29-2006, 10:11 AM
    • Posts 42
    • Points 125

    Hi Kevin, join us in this post: http://forums.asp.net/thread/1373404.aspx

    We searching for something similar, I think.

    The versions of the examples that is in this post are in PHP and ColdFusion, but we'll try doing a version for .NET (or searching the one that is already in .NET) and join our efforts to get something that look with the Cute Chat and Cute Web Messenger from CuteSoft!

    SO, JOIN US!

    Kalel

  • Re: Chat Style app using AJAX

    02-15-2007, 1:28 PM
    • Loading...
    • kalel
    • Joined on 05-29-2006, 10:11 AM
    • Posts 42
    • Points 125
    jodywbcb:

    here is some sample code of a chat app using Ajax from Rick Strahl's site- MS AJAX Samples updated for 1.0 Release Version

     

    Unfortantely - for the same reasons the other responder stated - server to client polling really can not be done.  What you could do is have two seperate polling requests 1. to get bit flag if work is to be done 2. if bit flag from first poll is true - then poll get the work item.  If load is an issue - you could instead of a bit flag pass the next next polling interval (which could increment or decrement according to number of users - a value of 0 would indicate - get work item. 

     

    Just a suggestion...

     

    Hy Jody! I was testing your chat and looks great!

    Do you wanna join us in the post for help in the constrution of a web messenger?

    Can I put your link in the post? For who is searching exactly for chat?

    My objective using this post is create a 'point' for join all related information about chats/web messengers/ instant messengers that uses the AJAX / ATLAS technology an, just like me, it's encountering dificultts to start.

    So i'll wait your answer,

    Thanks Man

     

Page 1 of 1 (5 items)