-
Notifications
You must be signed in to change notification settings - Fork 45
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
Access to underlying file descriptors? #65
Comments
This is related to #65. I managed to get websockets working using Conduit in order to gain access to the file descriptors. However, because streaming responses wait for the first write to flush response bodies, I could never deliver the connection upgrade with 1. an empty response body and 2. while not closing the writer. Making `wait_for_first_flush` configurable (which I see was already in the roadmap) solves this problem. I've tested this in my code and it's working really well now. Please let me know if you had thought of another way of configuring this behavior.
This is a proposal to fix #65. Access to the underlying file descriptors is (from what I gather) necessary to make use of a websocket connection. This proposal adds a new function, `Reqd.descriptor`, that returns the underlying file descriptor.
The best way to do this would be to modify the async and LWT runtimes. It could maybe made easier by adding something like I know there's a way to do this even without that change, but it escapes me at the moment. |
@seliopou, by the Async and Lwt runtimes, do you mean |
The former. |
This diff implements the suggestion given in inhabitedtype/httpaf#65 (comment) and adds a `Reqd.respond_with_upgrade` function, along with an upgrade handler to which the Async / Lwt runtimes can pass a file descriptor for applications to handle switching the protocol.
This diff implements the suggestion given in inhabitedtype/httpaf#65 (comment) and adds a `Reqd.respond_with_upgrade` function, along with an upgrade handler to which the Async / Lwt runtimes can pass a file descriptor for applications to handle switching the protocol.
I'm trying to upgrade an incoming request to a Websocket connection. Even though I'm able to upgrade the connection and send a response, it seems that for fixed length requests, httpaf closes the request body immediately, meaning that any more incoming data from the client is discarded.
I'm looking for another way to set this up, but I need your help:
Is there something else I should be doing that I'm missing?
The text was updated successfully, but these errors were encountered: