On Thu, May 26, 2011 at 10:43 AM, Michael Maul <[email protected]> wrote:
> Does any one know if it is possible to do a streaming response in orbit? If
> not how to go out side orbit to do that
>
>
>
Yes, it is possible. You need to use dispatch_wsapi instead of dispatch_post
or dispatch_get.
For instance:
_M:dispatch_wsapi(retrieveFile, "/get/([^.]*)")
function retrieveFile(wsapi_env)
local request = wsapi.request.new(wsapi_env)
local headers = {}
local status = "404 Not Found"
headers["Content-Type"] = "application/octet-stream"
return status, headers, coroutine.wrap(function()
coroutine.yield("yield")
coroutine.yield("each piece")
coroutine.yield("of data")
coroutine.yield("whenever it")
coroutine.yield("becames available")
end)
end
_______________________________________________
Kepler-Project mailing list
[email protected]
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/