473,396 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Ajax chat system - Active HTTP connection?

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 16 '06 #1
2 2199
ja********@gmail.com 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?

Thank You!
- Jason
No, it's not possible to continue an active HTTP connection. That's not
how the protocol works.

Don't know how Meebo or Gmail do it; never looked. But if I were doing
it I'd use java.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 17 '06 #2

ja********@gmail.com wrote:
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?
What you are looking for is "Reverse AJAX". In this case, the goal is
to raise events from the server to multiple clients. One way to do it
is to create a zero-sized frame and have a page that loads as slowly as
possible. You basically then would slap events into the streaming HTML
in the invisible frame, process the messages via JavaScript and send
them to an event handler that exists in the main frame. Polling is
another way, as you have done. Latency is the main downfall of that
approach.

One main caveat... Remember, that each client now has a connection
with your server that is continually loading a page. If you are ever
seeing a couple thousand users, at most, the networking layer on the
server should be able to handle it. Anything more than that, probably
not.

Here is some further reading:

http://ajaxpatterns.org/HTTP_Streaming
http://gmapsdotnetcontrol.blogspot.c...ajax-ajax.html

And here is a resource on "slow loading" a page:
http://www.obviously.com/tech_tips/slow_load_technique

Good luck! ;-)

Joseph

Sep 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: John Wright | last post by:
I am trying to create a very simple chat program using UDP through a web page. I am having problems getting this going. All the examples I've seen deal with remoting or application variables, or...
2
by: jason.m.ho | last post by:
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...
8
by: jason.m.ho | last post by:
>From the common user perspective (like my grandma), why would they care if its a java applet or an ajax application? Say I want to make a chat system on my website...If i'm doing really involved...
1
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX -...
3
by: work.Yehuda | last post by:
I'm Trying to write a chat width AJAX. For so far it works fine in Firefox browser, The only problem I had is width the Explorer. The function setTimeOut doesn't seem to work well width AJAX. The...
1
oll3i
by: oll3i | last post by:
how do i run this example ? with openjms package com.ociweb.jms; import java.io.*; import javax.jms.*; import javax.naming.*;
1
oll3i
by: oll3i | last post by:
when i run it from bat (@start "CHAT to topic" run Chat)without durable subscriber the window for chat opens but when i added the durable subscriber to the code it stopped opening? import...
4
by: Gandalf | last post by:
I wrote a chat width AJAX. In my home wampserver apache it works just fine. The problem starts when I trying to upload the chat in to my real server. The chat prints error 403 in places which it...
5
by: Tem | last post by:
Does anyone know how web-based chat like Gtalk in gmail works? how come it doesn't need to constantly refresh/send a request to the server to get new message? other web based chat room have to...
20
by: Bryan A | last post by:
Is there a way to add a timeout to this script so that it times out at a certain time. So it would be auto updating every 2seconds and it would timeout like after 100 seconds with a message?. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.