You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kartweel <rh...@exemail.com.au> on 2010/08/13 06:45:51 UTC
T5.1 Ajax requests and responses out of order
Hi,
Before I re-invent the wheel, I was wondering if anyone has dealt with ajax
requests and responses being out of order?.
Issue 1
I have a field which submits with each character typed (with the goal of
filtering down a list). What is happening is that the anti-virus is scanning
the submitted data and the second request is arriving at the server before
the first request. This could happen even without the anti-virus because
messages are not guaranteed to be in order.
Issue 2
Depending on the processing time of each request (and also variables with
the network, etc). Responses could also arrive out of order (which I have
also had happen). The result usually meaning that the later response is
"overwritten" by the first one, so the results I see are not correct for the
input that is currently on the screen.
In both cases it means my clients view of the data and the server view of
the data are out of sync, which is not acceptible.
For my case it would be acceptable to simply drop out of order requests. But
I was wondering if anyone else has got some tapestry extension or if there
is a better way to deal with this?. My approach was to just send an
incrementing number with each request and response (unique to each "event")
and then drop them at the other end if the number received is not the
maximum.
Wouldn't it be good if there was a way it could automatically be taken care
of, or even re-order messages into order!. Just like a TCP stream :).
Thanks, Ryan
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-1-Ajax-requests-and-responses-out-of-order-tp2524956p2524956.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5.1 Ajax requests and responses out of order
Posted by Kartweel <rh...@exemail.com.au>.
Thanks, That is a great idea. Much simpler than implementing the token
idea but would achieve a good result in my case.
On 13/08/2010 5:38 PM, Andreas Andreou-4 [via Tapestry] wrote:
> dojo used to have queueBind - that would trigger an ajax request only
> after
> the previous one had returned... the implementation is just a few
> lines, see
> http://bugs.dojotoolkit.org/browser/trunk/src/io/common.js?rev=7811
> around line 340
>
>
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-1-Ajax-requests-and-responses-out-of-order-tp2524956p2636275.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
Re: T5.1 Ajax requests and responses out of order
Posted by Andreas Andreou <an...@di.uoa.gr>.
dojo used to have queueBind - that would trigger an ajax request only after
the previous one had returned... the implementation is just a few lines, see
http://bugs.dojotoolkit.org/browser/trunk/src/io/common.js?rev=7811
around line 340
On Fri, Aug 13, 2010 at 08:44, Kartweel <rh...@exemail.com.au> wrote:
>
>
> Josh Canfield wrote:
>>
>> If Autocomplete isn't want you want then you could implement a
>> timeout so you only send the data when the user pauses. You can look
>> inside the scriptaculous code for an example.
>>
>
> Thanks. I actually have implemented a timeout so it only submits when the
> user pauses. I've set it to 300ms, so it can cope with a bit of network
> latency issues, but it isn't a 100% reliable solution. The other spot I use
> the same approach in is for some calculated fields, they calculate and
> update as the user types (or when they pause after typing). But still if the
> first response takes 3 seconds and the second only takes 200ms (which is
> what my anti-virus is causing to happen!, when I disable it everything works
> better) then I need something more reliable than a timeout, and it doesn't
> make sense to make the timeout 4 seconds.
>
> Do you know of any libraries or avenues to start working on a token to track
> that requests / responses are in order?. It is a generic problem so I am
> hoping there is something out there already. Very similar issue really to
> when a user hits the back button in a non-ajax environment. Or even if
> someone hits a submit button twice. Frameworks should have thing built in
> that are configurable to handle this sort of thing.
>
> THanks, Ryan
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/T5-1-Ajax-requests-and-responses-out-of-order-tp2524956p2531877.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry PMC / Tacos developer
Open Source / JEE Consulting
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5.1 Ajax requests and responses out of order
Posted by Kartweel <rh...@exemail.com.au>.
Josh Canfield wrote:
>
> If Autocomplete isn't want you want then you could implement a
> timeout so you only send the data when the user pauses. You can look
> inside the scriptaculous code for an example.
>
Thanks. I actually have implemented a timeout so it only submits when the
user pauses. I've set it to 300ms, so it can cope with a bit of network
latency issues, but it isn't a 100% reliable solution. The other spot I use
the same approach in is for some calculated fields, they calculate and
update as the user types (or when they pause after typing). But still if the
first response takes 3 seconds and the second only takes 200ms (which is
what my anti-virus is causing to happen!, when I disable it everything works
better) then I need something more reliable than a timeout, and it doesn't
make sense to make the timeout 4 seconds.
Do you know of any libraries or avenues to start working on a token to track
that requests / responses are in order?. It is a generic problem so I am
hoping there is something out there already. Very similar issue really to
when a user hits the back button in a non-ajax environment. Or even if
someone hits a submit button twice. Frameworks should have thing built in
that are configurable to handle this sort of thing.
THanks, Ryan
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-1-Ajax-requests-and-responses-out-of-order-tp2524956p2531877.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5.1 Ajax requests and responses out of order
Posted by Josh Canfield <jo...@gmail.com>.
Sounds like Tapestry's Autocomplete mixin; based on the autocomplete
control from scriptaculous.
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/mixins/Autocomplete.html
If I know what I'm going to type into your input box then I'm probably
going to be done typing before the request for the first letter gets
back. If Autocomplete isn't want you want then you could implement a
timeout so you only send the data when the user pauses. You can look
inside the scriptaculous code for an example.
If you really want to send every keystroke and dropping the out of
order responses is ok then using an ordered token seems like a
reasonable solution.
Josh
On Thu, Aug 12, 2010 at 9:45 PM, Kartweel <rh...@exemail.com.au> wrote:
>
> Hi,
>
> Before I re-invent the wheel, I was wondering if anyone has dealt with ajax
> requests and responses being out of order?.
>
> Issue 1
> I have a field which submits with each character typed (with the goal of
> filtering down a list). What is happening is that the anti-virus is scanning
> the submitted data and the second request is arriving at the server before
> the first request. This could happen even without the anti-virus because
> messages are not guaranteed to be in order.
>
> Issue 2
> Depending on the processing time of each request (and also variables with
> the network, etc). Responses could also arrive out of order (which I have
> also had happen). The result usually meaning that the later response is
> "overwritten" by the first one, so the results I see are not correct for the
> input that is currently on the screen.
>
> In both cases it means my clients view of the data and the server view of
> the data are out of sync, which is not acceptible.
>
> For my case it would be acceptable to simply drop out of order requests. But
> I was wondering if anyone else has got some tapestry extension or if there
> is a better way to deal with this?. My approach was to just send an
> incrementing number with each request and response (unique to each "event")
> and then drop them at the other end if the number received is not the
> maximum.
>
> Wouldn't it be good if there was a way it could automatically be taken care
> of, or even re-order messages into order!. Just like a TCP stream :).
>
> Thanks, Ryan
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/T5-1-Ajax-requests-and-responses-out-of-order-tp2524956p2524956.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org