3 ms·
I like that it's sort of inspired by the WSGI model, but it seems like it's missing a key piece: I want to return a 'generator' as the last object in the respon
by aston 17y ago
I like that it's sort of inspired by the WSGI model, but it seems like it's missing a key piece: I want to return a 'generator' as the last object in the response list so that I can stream content. I guess the JS version of that would be a function?
- tlrobinson 17y agoCurrently the body of the response can be any object that has a "forEach" method. For example: return [200, {}, { forEach : function(block) { block("a"); sleep(1000); block("b"); sleep(1000); block("c"); }]; Would output "a", wait 1000ms, output "b", etc. The Response helper object (part of the "Jack" implementation not "JSGI" specification) makes it even easier: return response.finish(function(block) { // etc } Still working on an async API though. The Jack/JSGI site is currently at http://jackjs.org http://jackjs.org