Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there an example of sending HTTP response asynchronously? #238

Open
bharat42 opened this issue Aug 23, 2018 · 1 comment
Open

Is there an example of sending HTTP response asynchronously? #238

bharat42 opened this issue Aug 23, 2018 · 1 comment

Comments

@bharat42
Copy link

In my implementation, for every HTTP request received, I need to make an asynchronous HTTP request to a remote server. I need to wait till the response is received from that remote server before I return a status code in my Lwan request handler function.

Instead of returning a status from the handler function, I was expecting to call a function like "lwan_send_response" with content as param once my handler is ready to send the response.

@lpereira
Copy link
Owner

There's no way, right now, to perform something like this efficiently. The only way, right now, is to use non-blocking sockets, and spin on a call to read(), yielding whenever read() returns -EAGAIN. Work on this has started, though, and it's partially implemented (to allow e.g. corooutines to sleep), but I haven't progressed much beyond what's on the tree right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants