Loading ...
Sorry, an error occurred while loading the content.

368Connection Manager - Multiple Posts - Catching Open Connections

Expand Messages
  • David Prusak
    Mar 1, 2006
    • 0 Attachment
      Hi all,

      I have a very strange situation in which I need to send multiple
      posts to different URL's at the same time (or I could do this in a
      linear fashion, but though async would save some time for better
      user experience.

      Here's the situation. The number of posts I need to complete are
      dynamic based on the number of items the user has. Each item can
      have 0, 1 or 2 posts. Let's think of it has saving and deleting
      files and number of hard drives.

      This particular user has 2 hard drives and a list of files on each.
      They choose which to delete and which to save.

      There is 1 URL to post to for the save routine, and another URL for
      the delete routine, (which I don't have control over).

      The sudo code I have now is:

      for (each hard drive){
      if there is a saved list
      var mySave = YAHOO.util.Connect.asyncRequest
      ('POST',uiServer+'/save.php, callbackSave, savedListPostData);
      if there is a delete list
      var myDelete = YAHOO.util.Connect.asyncRequest
      ('POST',uiServer+'/delete.php, callbackdelete, deleteListPostData);

      This can create multiple connection handle and what I'm, not fond of
      is the possibility of the variable getting stomp over if there are
      more than 1 hard drive.

      My question is that I know I can check to see if the connection
      handle is currently active, but can I piggy back off that same
      connection handle (multiple post objects?) so I don't create a new
      connection handle stomping on the first? Is there a way in the
      connection manager to do this?

      The reason is that after all the connections are done, I need to
      inform the user that the save/delete has successfully completed or
      errored out. With a possibility of many open connections, it
      difficult to manage this. I know I can do this in a more linear
      fashion, but I was wondering if there is a better approach.

      I hope I was able to explain this clearly :)

    • Show all 3 messages in this topic