"Ajax" upload suspends Comet

87 views
Skip to first unread message

Maarten Koopmans

unread,
Jan 25, 2011, 11:37:06 AM1/25/11
to Lif...@googlegroups.com
Hi,

Kind of an urgent/important question, that (I would hope) makes life much better for many people in the older browser universe with file uploads/progress. GIT repo below. WIki docu will follow once I know how to solve this.


i.e.:

<lift:surround with="default" at="content">
    <iframe id="upload_target" name="upload_target" src="#" style="width: 0;height:0;border:0px solid #fff;"></iframe>
<lift:DevTest.uploader form="POST" multipart="true" id="upload_form" target="upload_target">
  <upload:loader/>
  <upload:submit/>
</lift:DevTest.uploader>
<lift:comet type="CometMessage" name="Other">
   <up:main></up:main> 
</lift:comet>
</lift:surround>

"the hidden frame post Ajax trick". However, I have noticed in Safari and FF that the comet code suspends during the upload.
Also, in FF the upload field seems to return no data and behaves weird - soI have used an old valums.com widget to test there that does the same thing (and suffers from the same problem).

You can see it in action via https://github.com/mbk/ajaxupload_with_comet

Be sure to run sbt update first as it runs against 2.3-SNAPSHOT. Then click the upload text and upload a reasonably large file on your localhost (I found that 300MB shows a suspend of a few seconds on my McMini - which is a tribute to Lift's speed).

Some additional thoughts:

- I started from a fresh 2.2 repository and updated to 2.3-SNAPSHOT and tried to make a multipart upload form using tags. Attributes with html5 is not a good idea(?). Uncommenting the HTML5 parser in Boot wasn't either. Just a FYI

- I am using said valums widget, but the same effect can be observed with the trick described above.

- I am not too sure I like the default HTML5 parsing (but it is SNAPSHOT, so maybe that's it). Simple stuff like multipart file uploads suddenly break (at least for me :-)

Any clues? Because once I get comet out of suspended mode I can easily add a file upload widget with progress reporting on upload for all browsers. 
Just to be clear: the goal is to get the comet support working. I have put the clock there because you can see it suspending/resuming, but a comet actor that uses the LiftSession progressListener works as well - it just never gets the data back in the browser.

Best, Maarten


Maarten Koopmans

unread,
Jan 25, 2011, 3:04:14 PM1/25/11
to Lif...@googlegroups.com
This is a bit of a show stopper for me, I also tried to integrate something like http://www.xinotes.org/notes/note/769/ client side, but to no avail. I suspect that this has to do with Lift's long polling mechanism (or interference with that), but that's a wild guess.

As this is quite important for me to get working, I'd really appreciate any feedback/clues/... 

If it takes significant time, contact me off list to work something out.

--Maarten

Maarten Koopmans

unread,
Jan 26, 2011, 4:07:05 AM1/26/11
to Lif...@googlegroups.com
Well, it still suspends comet, but I have something working. I'll put it in the github repo later today.

David Pollak

unread,
Jan 26, 2011, 9:17:44 AM1/26/11
to lif...@googlegroups.com
On Wed, Jan 26, 2011 at 1:07 AM, Maarten Koopmans <maarten....@gmail.com> wrote:
Well, it still suspends comet, but I have something working. I'll put it in the github repo later today.

I'll look at it today
 
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.



--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im
Surf the harmonics

David Pollak

unread,
Jan 27, 2011, 2:05:58 PM1/27/11
to lif...@googlegroups.com
On Wed, Jan 26, 2011 at 6:17 AM, David Pollak <feeder.of...@gmail.com> wrote:


On Wed, Jan 26, 2011 at 1:07 AM, Maarten Koopmans <maarten....@gmail.com> wrote:
Well, it still suspends comet, but I have something working. I'll put it in the github repo later today.

I'll look at it today

I can't reproduce a case where the Ajax upload (based on your example code) blocked Comet.
 

Maarten Koopmans

unread,
Jan 27, 2011, 2:15:05 PM1/27/11
to lif...@googlegroups.com
On OS X FF and Safari it does, the clock suspends while uploading. Can
somebody else confirm?

On Thursday, January 27, 2011, David Pollak


<feeder.of...@gmail.com> wrote:
>
>
> On Wed, Jan 26, 2011 at 6:17 AM, David Pollak <feeder.of...@gmail.com> wrote:
>
>
>
> On Wed, Jan 26, 2011 at 1:07 AM, Maarten Koopmans <maarten....@gmail.com> wrote:
>
> Well, it still suspends comet, but I have something working. I'll put it in the github repo later today.
> I'll look at it today
>
> I can't reproduce a case where the Ajax upload (based on your example code) blocked Comet.
>
>
>
>
> On Tue, Jan 25, 2011 at 9:04 PM, Maarten Koopmans <maarten....@gmail.com> wrote:
> This is a bit of a show stopper for me, I also tried to integrate something like http://www.xinotes.org/notes/note/769/ client side, but to no avail. I suspect that this has to do with Lift's long polling mechanism (or interference with that), but that's a wild guess.
>
>
>
>
> As this is quite important for me to get working, I'd really appreciate any feedback/clues/...
> If it takes significant time, contact me off list to work something out.
>
>
>
>
> --Maarten
>
> On Tue, Jan 25, 2011 at 5:37 PM, Maarten Koopmans <maarten....@gmail.com> wrote:
> Hi,
> Kind of an urgent/important question, that (I would hope) makes life much better for many people in the older browser universe with file uploads/progress. GIT repo below. WIki docu will follow once I know how to solve this.
>
> I am doing something similar to what's discussed here https://groups.google.com/group/liftweb/browse_thread/thread/77a29a2ec48479d3/d8de395341bb179a?hl=nl&lnk=gst&q=upload+progress#d8de395341bb179a
>
>
>
>
>
>
> i.e.:
> <lift:surround with="default" at="content">    <iframe id="upload_target" name="upload_target" src="#" style="width: 0;height:0;border:0px solid #fff;"></iframe>
>
>
>
>
>
> <lift:DevTest.uploader form="POST" multipart="true" id="upload_form" target="upload_target">   <upload:loader/>
>
>
>
>
>
>   <upload:submit/> </lift:DevTest.uploader> <lift:comet type="CometMessage" name="Other">
>
>
>
>
>
>    <up:main></up:main>  </lift:comet></lift:surround>
>

> "the hidden frame post Ajax trick". However, I have noticed in Safari and FF that the comet code suspends during the upload.Also, in FF the upload field seems to return no data and behaves weird - soI have used an old valums.com widget to test there that does the same thing (and suffers from the same problem).


>
>
>
>
>
> You can see it in action via https://github.com/mbk/ajaxupload_with_comet
> Be sure to run sbt update first as it runs against 2.3-SNAPSHOT. Then click the upload text and upload a reasonably large file on your localhost (I found that 300MB shows a suspend of a few seconds on my McMini - which is a tribute to Lift's speed).
>
>
>
>
>
>
> Some additional thoughts:
> - I started from a fresh 2.2 repository and updated to 2.3-SNAPSHOT and tried to make a multipart upload form using tags. Attributes with html5 is not a good idea(?). Uncommenting the HTML5 parser in Boot wasn't either. Just a FYI
>
>
>
>
>
> - I am using said valums widget, but the same effect can be observed with the trick described above.
> - I am not too sure I like the default HTML5 parsing (but it is SNAPSHOT, so maybe that's it). Simple stuff like multipart file uploads suddenly break (at least for me :-)
>
>
>
>
>
> Any clues? Because on
>

Maarten Koopmans

unread,
Jan 27, 2011, 3:28:54 PM1/27/11
to lif...@googlegroups.com
David,

My bad, I accidentally deleted the comet clock.... Pushed it to the github repo again, sorry for the inconvenience.

Note that the issue is not important to me anymore - the ajax upload demonstrated serves it purpose (in stead of comet updating via a progress listener).

--Maarten

David Pollak

unread,
Jan 28, 2011, 9:24:31 AM1/28/11
to lif...@googlegroups.com
On Thu, Jan 27, 2011 at 12:28 PM, Maarten Koopmans <maarten....@gmail.com> wrote:
David,

My bad, I accidentally deleted the comet clock.... Pushed it to the github repo again, sorry for the inconvenience.


In my test, I re-enabled the comet clock... it ticked every second.
 

Maarten Koopmans

unread,
Jan 28, 2011, 11:03:35 AM1/28/11
to lif...@googlegroups.com
Must be a platform thing then?

David Pollak

unread,
Jan 28, 2011, 12:10:13 PM1/28/11
to lif...@googlegroups.com
On Fri, Jan 28, 2011 at 8:03 AM, Maarten Koopmans <maarten....@gmail.com> wrote:
Must be a platform thing then?

I doubt it.

I'll retest the code.
 

Diego Medina

unread,
Jan 28, 2011, 1:27:19 PM1/28/11
to lif...@googlegroups.com
I gave the sample app a try and it blocks the clock on mac os x 10.5
using safari 5.0.3

I tested it uploading a 50mb file, and the clock did not update until
the progress bar went away

on FF 3.6, same thing.

Chrome 8.0.552.237 also blocked the clock
I had to try different file sizes (all local uploads), but a 50mb file
shoed the problem on all but FF. for FF I had to use a 200MB file.

I hope it helps.

Diego


On Fri, Jan 28, 2011 at 12:10 PM, David Pollak

--
Diego Medina
Web Developer
http://www.fmpwizard.com

David Pollak

unread,
Jan 28, 2011, 3:12:09 PM1/28/11
to lif...@googlegroups.com

Maarten Koopmans

unread,
Jan 28, 2011, 5:53:31 PM1/28/11
to lif...@googlegroups.com
Awesome, should I verify against snapshot or M1 ?

>>>>>> > avail. I suspect that this has to do with Lift's long polling mechanism (or<--

David Pollak

unread,
Jan 28, 2011, 10:01:28 PM1/28/11
to lif...@googlegroups.com

Snapshot

maarten

unread,
Jan 29, 2011, 3:03:15 AM1/29/11
to Lift
Verfied, cool. I'll check to see if I can make an upload progress for
this that works cross browser.

Thanks!

--Maarten

On 29 jan, 04:01, David Pollak <feeder.of.the.be...@gmail.com> wrote:
> Snapshot
> On Jan 28, 2011 2:53 PM, "Maarten Koopmans" <maarten.koopm...@gmail.com>
> wrote:> Awesome, should I verify against snapshot or M1 ?
>
> > On Friday, January 28, 2011, David Pollak <feeder.of.the.be...@gmail.com>
> wrote:
> >> Okay... I reproduced the issue, opened a ticket (
>
> https://www.assembla.com/spaces/liftweb/tickets/874-the-mechanism-for...)
> >>>>>>> <feeder.of.the.be...@gmail.com> wrote:
>
> >>>>>>> > On Wed, Jan 26, 2011 at 6:17 AM, David Pollak
> >>>>>>> > <feeder.of.the.be...@gmail.com> wrote:
>
> >>>>>>> > On Wed, Jan 26, 2011 at 1:07 AM, Maarten Koopmans
> >>>>>>> > <maarten.koopm...@gmail.com> wrote:
>
> >>>>>>> > Well, it still suspends comet, but I have something working. I'll
> put
> >>>>>>> > it in the github repo later today.
> >>>>>>> > I'll look at it today
>
> >>>>>>> > I can't reproduce a case where the Ajax upload (based on your
> example
> >>>>>>> > code) blocked Comet.
>
> >>>>>>> > On Tue, Jan 25, 2011 at 9:04 PM, Maarten Koopmans
> >>>>>>> > <maarten.koopm...@gmail.com> wrote:
> >>>>>>> > This is a bit of a show stopper for me, I also tried to integrate
> >>>>>>> > something likehttp://www.xinotes.org/notes/note/769/client side,
> but to no
> >>>>>>> > avail. I suspect that this has to do with Lift's long polling
> mechanism (or<--
> >> Lift, the simply functional web frameworkhttp://liftweb.net
> >> Beginning Scalahttp://www.apress.com/book/view/1430219890
> >> Follow me:http://twitter.com/dpp
> >> Blog:http://goodstuff.im
> >> Surf the harmonics
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> >> To post to this group, send email to lif...@googlegroups.com.
> >> To unsubscribe from this group, send email to
>
> liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com >
> .>> For more options, visit this group at
>
> http://groups.google.com/group/liftweb?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> "Lift" group.
> > To post to this group, send email to lif...@googlegroups.com.
> > To unsubscribe from this group, send email to
>
> liftweb+u...@googlegroups.com<liftweb%2Bunsu...@googlegroups.com >
> .> For more options, visit this group at
>
> http://groups.google.com/group/liftweb?hl=en.
>
>
>
>

maarten

unread,
Jan 29, 2011, 3:11:07 AM1/29/11
to Lift
....and I updated the github repo to have the comet actor show the
upload progress (the original use case). I'll clean this up, test with
IE, and push again.

And then I'll write a nice Wiki page! Note that this would eliminate
ticket 745 (ajax file upload) then....

--Maarten

David Pollak

unread,
Jan 29, 2011, 12:13:02 PM1/29/11
to lif...@googlegroups.com
On Sat, Jan 29, 2011 at 12:11 AM, maarten <maarten....@gmail.com> wrote:
....and I updated the github repo to have the comet actor show the
upload progress (the original use case). I'll clean this up, test with
IE, and push again.

And then I'll write a nice Wiki page! Note that this would eliminate
ticket 745 (ajax file upload) then....

I intend to keep 745 open because I want to add an ajax upload widget to lift-widgets.
 

--Maarten
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.




--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890

Maarten Koopmans

unread,
Jan 30, 2011, 6:38:11 AM1/30/11
to lif...@googlegroups.com
OK, I got an Ajax upload working with feedback via comet - in . I generate a CometActor per tab and use a session var to store the progress, but somehow that is shared by all tabs. I'll post it as question (for searchability) in another thread.

But in one tab it works in IE and Safari (FF seems to hardly update on OS X, I'll cross-test that on Win/Lin).

g...@github.com:mbk/ajaxupload_with_comet.git   is where the result is.

--Maarten
Reply all
Reply to author
Forward
0 new messages