tjbush / mochiweb

Automatically exported from code.google.com/p/mochiweb
Other
0 stars 0 forks source link

export a continuation from mochiweb_http so hibernating processes can return to the loop #44

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
if you're writing a web app that implements comet long polling, you'll 
save a lot of memory by hibernating between the request and response.  
however, since the execution context is discarded when the handler 
hibernates, control flow falls out the bottom of your callback, the 
handler terminates, and keep alives don't work.

if mochiweb_http exposes a continuation that encapsulates returning to 
the top of the request loop then we can call that in our hibernate 
callback, and control flow returns to mochiweb like it would have without 
hibernate.  

does that sound reasonable?  i've included a patch that does that without 
changing the existing interface, so it shouldn't bother existing user 
code.  i've also included an example showing how to make a server with 
it.  some of that longwindedness might get rolled into a comment or 
included in some documentation somewhere, cuz it's not really 
straightforward.

speaking of documentation: it'd be useful to have a web page somewhere 
with an introduction and some examples.  i could throw my example on a 
blog somewhere, but it'd be nice for the project if there were 
centralized docs.  i'd be willing to compile what's out there on the 
blogs with my experience into a quick tutorial if you think that'd help.

thanks,
chris

Original issue reported on code.google.com by chris.p...@gmail.com on 16 Sep 2009 at 7:48

Attachments:

GoogleCodeExporter commented 8 years ago
applied in r106

Original comment by bob.ippo...@gmail.com on 28 Sep 2009 at 7:11