Hi,
Is it possible for an AJAX request to be left open for multiple
responses? This could avoid repetitive polling of the server.
Thanks,
Peter 17 13123
Randy Webb wrote: pe**********@gmail.com said the following on 4/13/2006 11:29 PM: Hi,
Is it possible for an AJAX request to be left open for multiple responses? This could avoid repetitive polling of the server.
Did you try it?
Is this code for yes? I haven't tried. I don't even know where I would
begin yet.
Peter pe**********@gmail.com napisal(a): Hi,
Is it possible for an AJAX request to be left open for multiple responses? This could avoid repetitive polling of the server.
First of all, the HTTP protocol which is used by UA's or AJAX is
request/response* protocol (* response is not required) - so for one
request only one response can be done - the HTTP 1.1 enhancements (like
persistence and pipelining) happens behind the scenes... and from
within AJAX (XmlHttpObject) there is no way to enable/disable that
(only from browser setting - enabling HTTP 1.1 protocol.
From my point of view there is little point to ask here such generic
question... you will get better answers if problems you ask is more
concrete.
Best regards
Luke M.
Luke Matuszewski wrote: pe**********@gmail.com napisal(a): Hi,
Is it possible for an AJAX request to be left open for multiple responses? This could avoid repetitive polling of the server.
First of all, the HTTP protocol which is used by UA's or AJAX is request/response* protocol (* response is not required) - so for one request only one response can be done - the HTTP 1.1 enhancements (like persistence and pipelining) happens behind the scenes... and from within AJAX (XmlHttpObject) there is no way to enable/disable that (only from browser setting - enabling HTTP 1.1 protocol.
Hi Luke,
That sounds like a definitive "no". Thanks for the information. That
saves me a lot of time.
Peter pe**********@gmail.com wrote: Hi,
Is it possible for an AJAX request to be left open for multiple responses? This could avoid repetitive polling of the server.
I've faced a similar situation, and AFAIK, you cannot open an
XMLHttpRequest and get back multiple responses. However, it seems that
you can keep the request open for an indefinite time.
Why not make the request, then the response handler can repeat the
request? So basically, you get the sequence:
-> UA sends Request 1
-> UA waits
-> UA gets Response 1
-> UA sends Request 2
etc...
Of course, you need to be aware that most browsers will only allow two
open requests at a time, so by doing this, you limit yourself to only
one usable connection. pe**********@gmail.com wrote: Luke Matuszewski wrote: pe**********@gmail.com napisal(a): Hi,
Is it possible for an AJAX request to be left open for multiple responses? This could avoid repetitive polling of the server. First of all, the HTTP protocol which is used by UA's or AJAX is request/response* protocol (* response is not required) - so for one request only one response can be done - the HTTP 1.1 enhancements (like persistence and pipelining) happens behind the scenes... and from within AJAX (XmlHttpObject) there is no way to enable/disable that (only from browser setting - enabling HTTP 1.1 protocol.
Hi Luke,
That sounds like a definitive "no". Thanks for the information. That saves me a lot of time.
People are rethinking this: http://alex.dojotoolkit.org/?p=545
But personally, I'd go for DWR's polling approach to "pushing" available
in version 2: http://getahead.ltd.uk/dwr/changelog/dwr20m1
ExG
TheBagbournes wrote: pe**********@gmail.com wrote: Is it possible for an AJAX request to be left open for multiple responses? This could avoid repetitive polling of the server.
People are rethinking this: http://alex.dojotoolkit.org/?p=545
But personally, I'd go for DWR's polling approach to "pushing" available in version 2: http://getahead.ltd.uk/dwr/changelog/dwr20m1
Thanks for these links. These ideas are very interesting. After reading
a few pages about Comet is sounds like it is still experimental. Maybe
the next generation of web servers will improve things.
I think for my situation it will be ok to just have the client poll the
server every couple of seconds to see if there are any changes. If the
client tries to make a server db change based on stale browser data, I
will produce some sort of error. Probably need this stale checking even
with a Comet-type system.
Thanks again,
Peter
TheBagbournes wrote: People are rethinking this: http://alex.dojotoolkit.org/?p=545
I may be terribly wrong of course, but the above looks like a
promotional scam. I base it on the wording, some details and the total
lack of real explanations and samples.
I believe it is the same pre-historic trick used to animate graphics on
the page before GIF89a format appeared: serve a hugely big content
length header so recipient stays in the receiving mode and keep
uploading packets. That was used for <img>, but maybe somehow it was
twisted for another object.
HTTP is an "ask it - got it - get away" protocol. One must be unsane to
install something on server to allow real long-lasting channels. It is
maybe semi-OK for intranet but on a real web server you will run out of
any resources sooner than you manage to say "oops".
Conventional socket listeners could be helpful and maybe added some day
- but sooner not, for security reasons.
To OP: no, it is not possible.
VK wrote: TheBagbournes wrote: People are rethinking this: http://alex.dojotoolkit.org/?p=545
I may be terribly wrong of course, but the above looks like a promotional scam. I base it on the wording, some details and the total lack of real explanations and samples.
I believe it is the same pre-historic trick used to animate graphics on the page before GIF89a format appeared: serve a hugely big content length header so recipient stays in the receiving mode and keep uploading packets. That was used for <img>, but maybe somehow it was twisted for another object.
HTTP is an "ask it - got it - get away" protocol. One must be unsane to install something on server to allow real long-lasting channels. It is maybe semi-OK for intranet but on a real web server you will run out of any resources sooner than you manage to say "oops".
Conventional socket listeners could be helpful and maybe added some day - but sooner not, for security reasons.
To OP: no, it is not possible.
Actually, I agree with you. "Comet" sounds flaky, and seems an attempt
to defeat the request/response nature of HTTP.
Take a look at DWR 2 though (and this is not a self-promotional scam -
I'm just a developer who uses it being a bit enthusiastic). The "Reverse
Ajax" capability will be great. The usage is asynchronous calls from
Java in the server. The implementation is a setTimeout() "thread" in the
browser which polls the server with XMLHttpRequests (I don't know if you
can set the frequency - you *should* be able to) and calls your
Javascript methods on receipt.
I've been planning features for our new intranet web app like user
alerts and reminders. Actions due, messages received, system actions
(like shutdown etc). And reverse Ajax is the way I'm planning to go.
I'll have a Javascript object in a page which subscribes to events, and
an event manager servlet started in the server to which you publish
events which broadcasts events to subscribed pages.
ExG pe**********@gmail.com wrote: Thanks for these links. These ideas are very interesting. After reading a few pages about Comet is sounds like it is still experimental. Maybe the next generation of web servers will improve things.
LOL -
First SOAP, then AJAX, now Comet - looks like I called that one right!
TheBagbournes wrote: Take a look at DWR 2 though (and this is not a self-promotional scam - I'm just a developer who uses it being a bit enthusiastic). The "Reverse Ajax" capability will be great. The usage is asynchronous calls from Java in the server. The implementation is a setTimeout() "thread" in the browser which polls the server with XMLHttpRequests (I don't know if you can set the frequency - you *should* be able to) and calls your Javascript methods on receipt.
I've been planning features for our new intranet web app like user alerts and reminders. Actions due, messages received, system actions (like shutdown etc). And reverse Ajax is the way I'm planning to go.
I'll have a Javascript object in a page which subscribes to events, and an event manager servlet started in the server to which you publish events which broadcasts events to subscribed pages.
IMHO it is still the same age old way first implemented in HTML Chats.
Simply get out all these "coolers" (from cool == awesome) from your
solution: Java servlets, AJAX, JavaScript OOP. The rest will be the
same plain vanilla HTML page al 1996/1997 with a form and a
meta-refresh set to say 1sec or 5sec.
The way the Internet works for this purposes is shown in AIM, ICQ or
any other instant messaging program. Client-side you have a socket
listener running on one of 65,536 ports. You also inform the server on
what IP are you on. As soon as new data available it informs you by
sending packets to the socket listener. This is the only way it works:
and it works great effectivewise and resourcewise. Anything else is
just a merry-go-round of ancient HTML tricks.
The question is how to get a socket listener for a browser and make it
communicate with JavaScript run on the page. The old time it was easy
with a small Java applet, but now client-side Java became a rare bird.
What I would do is create your request with your functionality, then
parse results. If you need some kind of delay, you could put this into
your logic, while keeping the back comm open, and you might be able to
parse on the fly.
Might as well try it. But separate your returned blocks through some
kind of parsing.
Cheers
TheBagbournes wrote: Take a look at DWR 2 though (and this is not a self-promotional scam - I'm just a developer who uses it being a bit enthusiastic). The "Reverse Ajax" capability will be great. The usage is asynchronous calls from Java in the server. The implementation is a setTimeout() "thread" in the browser which polls the server with XMLHttpRequests (I don't know if you can set the frequency - you *should* be able to) and calls your Javascript methods on receipt.
I've been planning features for our new intranet web app like user alerts and reminders. Actions due, messages received, system actions (like shutdown etc). And reverse Ajax is the way I'm planning to go.
I'll have a Javascript object in a page which subscribes to events, and an event manager servlet started in the server to which you publish events which broadcasts events to subscribed pages.
Over the last few days I have prototyped a very similar system. The
client polls the server for new messages and then acts on those
messages appropriately. I'm curious what makes this "reverse AJAX"?
Are the DWR messages JavaScript that gets eval() when it reaches the
client?
My messages have been in the form of English. Any client side object
can subscribe to any English message. Any object can subscribe to any
string. For example an object might subscribe to "Pass the purple
turkey" message. This message does not have to be predefined. If the
server ever sends out a "Pass the purple turkey" message the
appropriate objects are notified and can do as they please. I may
switch to the server sending JavaScript messages that the client will
eval().
What I would really like to do is use this to update an unknown number
of parts of a page based on one or more messages. The goal is to avoid
stale browser views of the server database. The client event manager
will send out the server's message to find out which objects are
interested. The objects will respond to the event manager with a
request for a particular update. All of the requested updates will be
lumped together and sent to the server in one AJAX request. The server
will send a reply with all the necessary updates. If many elements need
updating this will limit the number of AJAX requests to only one. I
still have a lot of details to think through.
Peter
well all of these will be put into your parameters. What you COULD do
is Blowfish it or something so that it doesn't get messed around with
the back comm call. You could decrypt and parse into individual
'handler' assignments, then pack them all together into a global on the
server. Then, Blowfish it, bring it back, decrypt, split and do your
stuff via JS and park it into areas. Remember, this might all add up
on both client and server all for the sake of updating at the same
time. You could cascade your queries and make it efficient that way.
Good luck.
Actually, can you Blowfish in JS? I'm new to JS actually.
Cheers
BeeRich wrote: Actually, can you Blowfish in JS? I'm new to JS actually.
What is Blowfish?
Encryption algorhythm. So a long string like:
?colour=red&flavour=blueberry&weight=8
....can be changed to:
1e634cb8c9c7fa7d6e13f4d2bdd37830a29739f6e24ae566c8 99a143b31cb5957567ba7f649e8719
Longer strings can be represented by shorter encryption though. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tony |
last post by:
I've done a fair bit of searching on this, but I want to be certain
about what I've found - so here goes with a long example and three
questions:
For clarity, let me give an example (a number of...
|
by: petermichaux |
last post by:
Hi,
I am trying to put together the last major pieces of my project's
puzzle. This is more website/client-side architecture than
JavaScript syntax but I hope this is a good place to ask. I'm a...
|
by: Tony |
last post by:
I just noticed that prototype.js is one of the files in the Ajax.NET
distribution - I'm pretty concerned about this. Does anyone know if this
is the same "prototype.js" that is not well-liked...
|
by: Mark Knochen |
last post by:
Hi, i have a little problem with ajax.
The follow functions are in my site:
function sndReq(ID,divID)
{
resObjekt.open('get','inc/inc_change_pagelogo.php?ID='+ID,true);...
|
by: geevaa |
last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3
XMLHttpRequest and AJAX for PHP programmers
James Kassemi
Introduction:
Although the concept isn't entirely new, XMLHttpRequest...
|
by: Arjen |
last post by:
Hi,
I want to reload 2 divs at one click. Ive tried:
<a href = "javascript:void(0);"...
|
by: bizt |
last post by:
Hi,
I am having my first real attempt at an ajax class as so far Ive
managed to build one that, once instatiated, will allow me to define
which function it will call on completion then retrieves...
|
by: zalek |
last post by:
I am writing application with Ajax in sync mode - xmlHttp.open("GET",
url, false).
I noticed that in FireFox handler doesn't starts. It starts when I use
xmlHttp.open("GET", url,true).
I need to...
|
by: javediq143 |
last post by:
Hi All,
This is my first post in this forum. I'm developing a CMS for my latest website. This CMS is also in PhP & MySQL. I'm done with the ADD section where the Admin can INSERT new records in...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |