Skip to content

support async mode #1

@zah

Description

@zah

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions