support async mode #1

zah opened this Issue May 29, 2012 · 0 comments


None yet

1 participant


dom96, I haven't seen jester before. very cool!

There is one problem with the current internal design tho - since handlers have to return the response body, it's not possible for a handler to complete asynchronously. Imagine what will happen if a handler needs to talk to several other services over the network to build the response - this communication must be blocking, jester needs to spawn 1 thread per request (not cool) and ultimately it's better if the requests are carried out in parallel.

To allow async mode, it's better if the handler type is proc (TRequest, TResponse), where the TResponse holds a reference to the output stream. Ideally, the handler will be written as a coroutine once we have these in nimrod. This will be similar to the deferred generators in python's twisted framework and the new await keyword in C# 5 (await is really just a syntax sugar for a framework built around async futures and coroutines), but even this will be based on the same low-level proc (req, res) handlers.

@dom96 dom96 added a commit that closed this issue Jan 1, 2014
@dom96 Fixes #1.
Also exposed the client socket to the user.
@dom96 dom96 closed this in f1713bd Jan 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment