1 (edited by freddrat 2008-09-16 6:17:35 AM)

Topic: Multiple xajaxCometResponse instances


I want to execute sftp file uploads on different targets. The targets are shown in a table with a checkbox each if this target should be included in the update.

=> With only one button click I want to start the upload for all included targets. Is this possible with the comet plugin or am I completely lost? wink

I was unable to use 1 single button and do the upload in an own method (including a CometResponse) within a loop. The status columns were not updated with progress in percent.

Now, I start the upload on each target with a corresponding button in each row. Isn't it possible to handle multiple CometResponses at the same time?

function doUpload($row) {
  $response = new xajaxCometResponse();

  $response->assign("status_".$row, "innerHTML", ($i*25)."%");

  foreach($files as $file) { //4 files exactly

    //The whole sftp process takes place here...

    $response->assign("status_".$row, "innerHTML", ($i*25)."%");

  $response->assign("status_".$row, "innerHTML", "OK");
  return $response;

When I press the button in two different rows, the first row shows 0% until the upload is finished while the other row is updated as expected!  What have I done wrong?

Thanks for your help!

Re: Multiple xajaxCometResponse instances

It should work with parallel connections, though I haven't tested it myself. The main problem I see is, that browsers limit the number of connections to a certain site. If I remember correct IE doesn't allow more than 2 parallel connections, without modifying some registry values.
Sessions can also cause troubles - especially file based session. A php process locks the current session file until the script dies or until it calls session_write_close().