Skip to content

Document event arguments (http2, maybe more)Β #877

@grantila

Description

@grantila
  • Scope (install, code, runtime, meta, other?):
    Documentation

  • Module (and version) (if relevant):
    http2

When reading through parts of the http2 documentation, I'm missing information about what arguments are passed in many events. It's like documenting that there's a function called foo but not what argument it takes.

If an event is emitted without any arguments, writing "Emitted without any arguments" in the documentation would be helpful. I tend to console.log(arguments) just to see what's there, and this forces me to try to cause events to actually be emitted... I'm probably not the only one.

session:close 😟 I'm guessing none?
session:connect 😟 None? Also, what will I typically listen to?
session:error 😧 An error argument perhaps? No?
session:frameError πŸ˜‰ Well documented! But, the argument types have a different layout compared with:
session:goaway πŸ‘
session:localSettings πŸ˜• What properties can I expect?
session:remoteSettings πŸ˜• What properties can I expect?
session:stream πŸ˜” Flags? This is my flag: πŸ‡ΈπŸ‡ͺ
session:socketError 😰 What am I supposed to do?
session:timeout πŸ˜’ Doesn't look like any arguments by the example snippet. And should I expect Node to close the socket?

The same goes for the streams...

stream:aborted 😢 "Writable end". Is that my end, or the remote peers? Is abortion an error, i.e. should I expect an argument?
stream:error πŸ€’ No argument in an error event. Or? Probably there is one...
stream:frameError πŸ€” Interesting...
stream:streamClosed πŸ€— Actually useful description, since it describes how this event relates to the flow of other events.
stream:timeout πŸ™ What, am I supposed to do? I read the doc for setTimeout and it seems I should manually perform things in this event handler...
stream:trailers πŸ˜‚ More flags! πŸ³οΈβ€πŸŒˆ

I realize http2 is in early stage. But for early adopters and testers, this kind of information is very useful if it is provided. I've seen this lack of information before in other modules, so probably the documentation needs an overhaul of the events specifically, with exactly what is being sent.

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