Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #5592 (new enhancement)

Opened 2 years ago

Last modified 5 months ago

Ajax.Request should work around latency problems (process responses in order)

Reported by: fusion@ibiblio.org Assigned to: sam
Priority: normal Milestone:
Component: Prototype Version:
Severity: normal Keywords: latency ajax
Cc: jjb@ibiblio.org

Description

We have been using element observers for user registration feedback in Lyceum http://demo.lyceum.ibiblio.org/register but have discovered a problem.

new Form.Element.Observer('user_login', 0.1, 
	function(element, value) {
		new Ajax.Updater('usernameMsg','<?php echo WEBROOT ?>/ajax/availability.php', {
			asynchronous : true,
 			method : 'post',
			parameters : 'action=checkLogin&login='+ value
		})
	}
);

Because we set the observer to check a field every tenth of a second due to users complaining about lag time, we now find that sometimes the last message received does not correspond to the last message sent due to network congestion / routing / normal quirks. I had originally assumed TCP's guarantee would take care of that but I see it's a moot point because these are separate messages. If you felt like adding such functionality I'm sure it would be useful to many people who wish to have more responsive feedback.

Change History

07/05/06 00:22:19 changed by anonymous

  • cc set to jjb@ibiblio.org.

10/09/06 08:37:37 changed by mislav

  • keywords set to latency ajax.
  • priority changed from normal to high.
  • severity changed from normal to major.
  • summary changed from guarantee in-order message delivery with Ajax.Updater to Ajax.Request should work around latency problems.

This is called latency, a common problem. Prototype doesn't yet have anything to deal with this.

06/13/07 22:04:02 changed by savetheclocktower

  • severity changed from major to normal.
  • summary changed from Ajax.Request should work around latency problems to Ajax.Request should work around latency problems (process responses in order).

Mislav, I think your new summary is too vague -- latency applies to more than just the order in which requests are received.

Is this really Prototype's to take care of? The only way around the described problem would be to implement a queue of some sort -- so that only one Ajax call is active at a time. But I don't consider this to be a high priority -- or all that severe.

I'll keep the priority on "high" for now, but I don't think an enhancement can be of "major" severity. If you disagree then let's talk about it.

06/13/07 23:44:09 changed by mislav

This is what I had in mind: each request to a same resource gets an auto-incrementing ID. When it completes, Prototype checks if a request with a higher ID has already completed. If it did, then the response of the request in question is discarded, and callbacks are not called.

Nothing overcomplicated. The rest is left to the user. Do you agree? Am I being to dumb here and ignoring some higher problem? :]

06/18/07 22:55:32 changed by savetheclocktower

I think that's too unintuitive of a behavior. There's no general expectation that Ajax requests return in the order they were created. If a user wants this he can implement it in his own code. (That's my feeling.)

04/02/08 21:44:03 changed by jdalton

  • priority changed from high to normal.