-
Notifications
You must be signed in to change notification settings - Fork 26
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
'stream' vs 'request' API #19
Comments
I am not sure I understand this question. The frameworks who wish to support
The API itself is really dictated by the differences in the protocols AFAIK. I am not sure you could design an API around a stateful connection which just has
This is something I really think we might be able to do something about! I had some ideas around this I wrote up here: expressjs/discussions#82 (comment) I never got feedback on that as a starting point for Express to move toward a compat layer, so if you have time and want to chime in over there it would be awesome! I think beyond Express there is a great opportunity for us to push much of the shared API into core (or a userland compat layer) which would enable better code sharing between frameworks. |
The problem I see here is that no frameworks are moving towards this. They rather use the http2 compat layer to http1 since they want their frameworks to work for both use cases. One way to reverse this trend would be a forwards compat layer. That way frameworks can move towards this new API without excluding http1 users. |
To speak from the framework side: I would more say the main concern I would express is that users should be able to write their code without needing to care if a given request is http 1/2/3 unless they are going to specifically take advantage of a feature added in that new http version. Semantically they are all http, and for the current future typical public web servers will be getting http 1 traffic along with http 2. When I create a Node.js HTTP/2 server and use the stream event, I always have to also use the request event for HTTP/1 requests, and end up with a lot of duplication, so it ends up being easier to simply use the "compat" API and write everything in just a single format. That is my 2c. Having HTTP/1 come in "upgraded" to streams would certainly change the conversation. I also will add that I don't typically end up writing apps that can afford to only talk HTTP/2; I would bet the conversation would be different for folks who meet that case. |
One key question here though, does the "stream" API bring enough significant improvements to justify the extra work of a forwards compat layer? |
Gotcha. Unfortunately because of the above I just don't have a scenario where I can truly even test it out in a real world scenario, so don't have any feedback on that point. |
This becomes relevant in regards to where to prioritise our resources:
|
I think the best long term approach and what is pragmatic right now might be in conflict here. In the long run I think we need to move So I don't think it answers your question @ronag, but I think we need to do both things. In the long run, a good story in core around how these api's degrade to their older counterparts will not be wasted. But also I cannot see projects like Express moving quickly into this uncharted territory. Does that make sense? |
If I can five my 2c, most if not all existing frameworks will have to move to a streaming api at one point if they want to take advantage of all the new functionalities exposed by http2/3, ideally it would be transparent to the framework / project what protocol it's using, and they can check for functionalities by querying the stream for capabilities for example ( If at all possible ). The question becomes request + streaming or 'stream' http1 events also for the future. Me as a developer would prefer option 2 as it will simplify development. Moving to a stream api will break most if not all existing frameworks, so maybe keep existing API's as they are, and do a 'parallel' API for the future, the frameworks choose what to use. I imagine a lot of projects are written on top of the request pattern (projects not using any frameworks) so even if the frameworks change, those projects will very likely not move. To summarize: I see a lot of advantages for moving to a 'streaming' api, for me as a developer also for node, it can add other protocols that can be easily picked up by the frameworks or anyone using the new API. I also don't see the request pattern going away anytime soon. |
As discussed on todays meeting, with the long timeline on this, and no clear intent from frameworks to change anything meaningful soon, we will remove the agenda until more relevant progress is made. |
In http2 we got a new API for handling requests where instead of emitting a
'request'
event with a request and response object we emit'stream'
with a stream object.The text was updated successfully, but these errors were encountered: