--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
Jeppe,It's interesting. If multiple SFuncs on a page returned Future[JsCmd], I suppose they could be combined pretty easily, and if some returned JsCmd itself, those could be wrapped in a pre-satisfied Future. I've got to wonder though, if you'd doing asynchronous IO, why not just use comet and issue a partialUpdate when the data is available?
On Fri, Nov 16, 2012 at 10:20 AM, Jeppe Nejsum Madsen <je...@ingolfs.dk> wrote:On Fri, Nov 16, 2012 at 4:09 PM, David Whittaker <da...@iradix.com> wrote:Jeppe,It's interesting. If multiple SFuncs on a page returned Future[JsCmd], I suppose they could be combined pretty easily, and if some returned JsCmd itself, those could be wrapped in a pre-satisfied Future. I've got to wonder though, if you'd doing asynchronous IO, why not just use comet and issue a partialUpdate when the data is available?
Don't know :-) Not sure if it always fits or perhaps I just need to think harder.
In this case, the user clicks a download link (there could be many (100s)) this sends off an Ajax request which calls out (async) to S3 to generate a URL. When S3 returns the generated URL, it is passed back to the client. Just seems simpler with straight forward Ajax since, from a UI perspective, it is a blocking operation.
Hmmm..... so is the perceived benefit that rather than blocking while each FuncHolder is executed, Lift could execute them and then block on one Future that represented them all? Or are you thinking that this would mainly lead to cleaner code for calls like your example? I think a possible issue with this is that there are so many ways to represent an Async response. You are using Akka, Lift has it's own Future implementation, I've been using a lot of the new dispatch lately, which has it's own Promise type.....
/Jeppe
--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
My biggest concern is definitely that we don't want to depend on akka just to support their futures in a syntax like this.
I doubt you're going to have 500+ open Ajax requests on a single server (the point at which the threading issues become issues). So, I wouldn't want to mess around too much with trying to make some requests served Async and some synchronous. It's likely to be more damaging to performance and maintainability than it's worth.There's an existing mechanism that I introduced as part of Wiring that allows you to collect the JsCmds to piggy-back onto a response. That mechanism could be used to deal with Futures such that you could have lots of Futures pending for a response and the response would not be served until the futures are returned.
I've been working on mechanisms for unifying Lift's rendering with Streams/Futures and Comet as part of Lift 3.0. I'm noodling right now on a mechanism that's not as heavy-weight as Lift's comet stuff, but still allows push as data becomes available. I'm also noodling with browser-based Actors that do asynchronous messaging between the client and the server. I'll work this requirement (sending the results of futures back to the browser) into my design thoughts.
/Jeppe--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
/Jeppe--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
--
Depends on which parts you're referring to. To be clear, I'm talking about the web part at the end that they did with Play. The futures themselves are a different matter, and I haven't really looked into how Lift's futures do or don't compare (though I seem to recall they don't support the for comprehension)