Skip to content
This repository was archived by the owner on Jul 6, 2018. It is now read-only.
This repository was archived by the owner on Jul 6, 2018. It is now read-only.

Why is http2 exposed as a property of the http module? #29

Description

@RobertWHurst

Hi everyone. I'm just curious why http2 is exposed via require('http').HTTP2? Is this temporary, or the final API? It seems a bit clunky. I was hoping we'd see require('http2').

As an aside, this is really cool stuff. Really exciting to see this under development. Thanks for your efforts here. 🍻

Activity

  1. jasnell commented on Dec 16, 2016

    @jasnell
    Member

    There is an existing http2 module on npm that would conflict if we exposed the new http/2 functionality that way. It is unfortunate but necessary. And yes, hopefully it is temporary until a better solution can be found.

  2. sebdeckers commented on Dec 16, 2016

    @sebdeckers
    Contributor

    Could ask nicely if the author of h2 minds giving up their NPM name. Doesn't seem like there are many downloads. Also, http-2 with a hyphen is available.

  3. jasnell commented on Dec 16, 2016

    @jasnell
    Member

    Definite possibility. I'd rather avoid hyphenated names as much as possible. Requesting the h2 package name seems like a good choice.

  4. ChALkeR commented on Dec 16, 2016

    @ChALkeR
    Member

    http-2

    I expect a significant number of people mistyping that as http2 and wasting time on that in the best case, and gaining some other problems from that in the worst case.

  5. jasnell commented on Dec 16, 2016

    @jasnell
    Member

    @jmandzik ... how would you feel about the possibility of transitioning ownership of the h2 module name to Node.js core?

  6. RobertWHurst commented on Dec 16, 2016

    @RobertWHurst
    Author

    @nwgh If http2 gets added to core, would you mind giving up the namespace so the core solution can be be implemented elegantly?

  7. jmandzik commented on Dec 16, 2016

    @jmandzik

    @jasnell I'm happy to relinquish it, especially for node core! I'm traveling this weekend with limited access to computer, but I'll circle back with you Monday if that works.

  8. jasnell commented on Dec 16, 2016

    @jasnell
    Member
  9. RobertWHurst commented on Dec 18, 2016

    @RobertWHurst
    Author

    As much as I think h2 is better than a property tacked onto http, I think h2 might confuse users as it's not clear what h2 means. The core API should demonstrate good API design. I don't think h2 for http2 exactly fits in this regard as it's inconsistent with the http and https module. Would love to hear what @nwgh thinks here.

  10. nwgh commented on Dec 19, 2016

    @nwgh

    Hi all. Sorry for the lag, must be that time of year :) Anyway, I'm more than happy to give up the "http2" namespace for core. I definitely think that makes the most sense in all respects. I don't have great access to rename the package on npm right now, but later this week I'll rename to something (once I come up with a reasonable name) as I personally (in my role as a Firefox developer) will continue to depend on what we currently know as "http2", as we use that for integration testing of our http/2 stack.

    I also agree with @RobertWHurst that "h2" is a little un-descriptive. While it matches the ALPN token (and is what I normally use with other networking types), it's too easily confused with the h2 HTML tag. Best to be more explicit, in my opinion.

    I'll circle back around once I've done the rename to let everyone know the namespace is free.

  11. mcollina commented on Dec 19, 2016

    @mcollina
    SponsorMember

    @nwgh I don't know what is the process for all of this. We should probably get NPM and the TSC/CTC involved. I would like to keep the ecosystem disruption as small as possible.

  12. jasnell commented on Dec 19, 2016

    @jasnell
    Member

    We should definitely work through the process with npm... paging @zkat and @isaacs for assistance on this.

  13. zkat commented on Dec 19, 2016

    @zkat
    Contributor

    You shouldn't really need us for this. https://www.npmjs.com/policies/disputes is our name dispute policy, and it has instructions on transferring names (tl;dr npm owner add <new-owner>). Keep in mind that formerly-published versions cannot be published over, and if they've been out long enough, cannot be unpublished. This should not be an issue, as you can simply deprecate it with a message to use the native node@8 one, but even users on older nodes will see it.

    Personally, I'd just add a note in the README that http2 is superseded by the native module if you're in node@>=8. You could even add an engines entry so that it warns only on that.

    If you want more guidance than this or something actually official (I am not saying this stuff in any official capacity. I'm simply mentioning what options you have), then please email support@npmjs.com so we can handle this with existing processes. I don't see any issues, tho :)

  14. isaacs commented on Dec 19, 2016

    @isaacs
    Contributor

    What @zkat said also happens to be the official position of npm, Inc. on this matter.

    If node-core adds a new builtin that takes over a name currently used in npm, well, that sucks. We've been there before. Please be very careful about that.

    If you want the existing owner to move off the name, follow this: https://www.npmjs.com/policies/disputes

    If you want technical guidance about how to make that go smoothly, I'm happy to help out.

  15. jasnell commented on Dec 19, 2016

    @jasnell
    Member

    @zkat ... Thank you very much for the clarification. That's what I had suspected but wasn't sure if the unpublish policy changes had altered the process on this at all.

  16. 6 remaining items

  17. RobertWHurst commented on Jan 18, 2017

    @RobertWHurst
    Author

    Just my two cents here, but I believe it's better to be consistent with the rest of the core modules. http/2 implies to me that it's a sub component for the http module which it is not.

    As for rolling the major. It can't be done as core modules are not versioned in the user's package.json. As for code breakage, I would argue that when a user upgrades their node version a whole major, they are opting into breaking changes and will need to fix old code. This is the same as any major release of node where there are breaking changes. Adding HTTP2 should be a whole release major in itself.

  18. not-an-aardvark commented on Jan 18, 2017

    @not-an-aardvark
    Contributor

    As for code breakage, I would argue that when a user upgrades their node version a whole major, they are opting into breaking changes and will need to fix old code.

    The user might not be depending on http themselves -- they might have a dependency three levels deep which is using the http2 module. Upgrading in situations like this is often nontrivial. It's typically better to avoid breaking changes unless there's a good reason to do so, even in a major release.

    I'm not saying that we can't use the http2 name -- I'm just saying that we should consider non-breaking alternatives such as http/2 before we jump to the decision that a breaking change is the only way to go.

  19. RobertWHurst commented on Jan 18, 2017

    @RobertWHurst
    Author

    @not-an-aardvark I agree, minimizing breakage is very important. I would just add that so is consistency. Without it you end up with an ugly system. http/2 seems incorrect. A / in a module name has been a separator of a parent and child namespace. 2 is not a module name, and http is not it's parent.

    The course of action I think would be best here is that the http2 module gets republished under a new name, for example 'http-2' or something else. The original http2 module gets updated with a depreciation warning indicating users to switch to http-2. Then months later when Node is released with HTTP2 in core, the bulk of the users of the original http2 NPM module will have switched over to the new http-2 module, and the http2 namespace will be available.

    Based on my suggestion above I think the things we would need to know here are:

    • When is node with http2 likely to ship?
    • How many months before node ships do we need to update the http2 module with a depreciation warning?
    • What new namespace can we use for @nwgh's handy work to keep it available?
  20. not-an-aardvark commented on Jan 18, 2017

    @not-an-aardvark
    Contributor

    For what it's worth, I think http/2 could be reasonably consistent if we made http/1 an alias for http. http would effectively be a namespace for all the core http libraries (and it would scale well if there is ever an http3, for example).

  21. ronkorving commented on Jan 18, 2017

    @ronkorving
    Contributor

    I'm probably gonna sound like a complete tool (since I haven't really followed the API design work being done here), but can't http2 simply be married with the already existing built-in http and https? I'm sure that would be a challenge, but would it be impossible? Both spdy and http2 modules on NPM have an API that is in essence very similar to the built-in http module, they "just" add extra API on top of that.

  22. jasnell commented on Jan 18, 2017

    @jasnell
    Member

    The http/2 protocol is fundamentally different from http/1 is so many ways that somehow merging the two would be entirely impractical and, in many cases, impossible.

  23. isaacs commented on Jan 18, 2017

    @isaacs
    Contributor

    This really is a bikeshed. Here's what I'd recommend (because of course what this is lacking is Yet Another opinion, ha ha)

    1. Include HTTP/2 support in core as require("http").http2, as it currently is. As warts go, it's not a bad one.
    2. Send a PR to the http2 module to do this: var http = require('http'); if (http.http2) return module.exports = http.http2; // else, API-matching userland implementation. It might be a breaking change. That's fine, just bump the major version.
    3. Leave it that way until everyone is using a version of http2 that just exports the core module, and a version of node that includes http.http2. At that time, move the core module to require('http2') and the http2 author can npm deprecate http2 "HTTP/2 support is included in Node.js core now, this module is no longer necessary. People who really need to use the userland one can do require('http2/'). It may take a few years to get to that point. We at npm, Inc. are happy to provide y'all with version usage numbers and download counts.
    4. Never ever remove require('http').http2. Leave that there forever. It harms no one, and removing it would be unnecessary user-hostility.
  24. RobertWHurst commented on Jan 19, 2017

    @RobertWHurst
    Author

    @isaacs I see what you're saying here. I'm just unclear why you suggest going the warty road here. Unlike the browser environment node has proper versioning. The trade off here in my opinion is that node ends up looking rather confusing to newcomers. It doesn't seem unreasonable to ask that a node user update their code when they decide to bump the Node version a major release.

  25. isaacs commented on Jan 19, 2017

    @isaacs
    Contributor

    @RobertWHurst It's easy to underestimate the cost of breaking changes in Node.js, because as you say, upgrades are opt-in, so what's a few more changes?

    But these changes add up, and they result in creating the impression that Node.js is unstable, unreliable, and chasing newness for its own sake rather than investing in quality and the needs of users. You can argue it's unfair, but the fairness doesn't change the perception.

    We want people to upgrade. We should make it as easy as possible to do so, even if that means a slightly more cluttered API surface. And really, require('http').http2 is fine.

  26. akc42 commented on Jan 19, 2017

    @akc42

    Why should it be require('http').http2 and not require('https').http2 Also should not http2.createServer() with the same parameters as the https version be how you create a server?

  27. jasnell commented on Jan 19, 2017

    @jasnell
    Member

    At this point, we do not need to nail down what the exact namespace / entry point will be. We will have a reasonable entry point and we will take ecosystem impact into consideration in the process. I really appreciate the current owners of the h2 and http2 modules being willing to turn those over if necessary but it's too early to say for certain that we'll need them. When the time comes to finalize on that decision, the CTC will reach out and work through whatever issues there may be.

  28. Somebi commented on Feb 3, 2017

    @Somebi

    So after all, how it will be called? Any docs available? Is it available in nightly build? Any info related to http2 should be added to the main page. It's kinda missing or i wasn't reading carefully...

  29. jasnell commented on Feb 3, 2017

    @jasnell
    Member
  30. jasnell commented on May 5, 2017

    @jasnell
    Member

    Closing this as we're going to be going with require('http2') for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions