镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Is there a good way to track how recently data was received from the remote end of an http2 session? #21730

Description

@murgatroid99

I am trying to detect when a connection underlying an http2 session is broken using this strategy. In short, I want to send an http2 ping when I have at least one active stream (which I can track myself) and when I have not received any data from the server. Is there a good way to determine when was the latest time that I received any data from the server?

Activity

  1. added
    questionIssues asking questions about Node.js.
    http2Issues and PRs related to the http2 subsystem.
    on Jul 9, 2018
  2. davisjam commented on Jul 10, 2018

    @davisjam
    Contributor

    If you're looking for an application-level solution:

    You could update a timestamp (process.hrtime) every time data is received and compare it to the current time. Perhaps perform this comparison in a recurring timer.

  3. murgatroid99 commented on Jul 10, 2018

    @murgatroid99
    ContributorAuthor

    The issue here is that I am working with a http2 session object, but what I really want to track is every time data comes in on the underlying socket. That includes a variety of events on the http2 session and http2 stream objects, plus frames that don't trigger events at all, like WINDOW_UPDATE frames.

    Would it cause any problems to add an additional "data" event handler to the underlying http2session.socket?

  4. jasnell commented on Aug 10, 2018

    @jasnell
    Member

    This would be a bit difficult to do and would limit performance. One thing we could do is update an internal timestamp whenever data is received, but invoking a callback or event on every chunk of data would result in a significant performance loss.

  5. murgatroid99 commented on Aug 10, 2018

    @murgatroid99
    ContributorAuthor

    That timestamp would be all I really need here.

  6. added
    feature requestIssues requesting new Node.js features.
    and removed
    questionIssues asking questions about Node.js.
    on Aug 10, 2018
  7. jasnell commented on Aug 10, 2018

    @jasnell
    Member

    Will investigate the possibilities here. Marking as a feature request.

  8. Trott commented on Nov 16, 2018

    @Trott
    Member

    Will investigate the possibilities here. Marking as a feature request.

    @jasnell Any results to report?

  9. jasnell commented on Nov 16, 2018

    @jasnell
    Member

    I've got an open pr that I need to revisit in the next few weeks

  10. github-actions commented on Feb 28, 2022

    @github-actions
    Contributor

    There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.

    For more information on how the project manages feature requests, please consult the feature request management document.

  11. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Feb 28, 2022
  12. moved this to Pending Triage in Node.js feature requestson Feb 28, 2022
  13. moved this from Pending Triage to Stale in Node.js feature requestson Feb 28, 2022
  14. github-actions commented on Apr 4, 2022

    @github-actions
    Contributor

    There has been no activity on this feature request and it is being closed. If you feel closing this issue is not the right thing to do, please leave a comment.

    For more information on how the project manages feature requests, please consult the feature request management document.

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

    feature requestIssues requesting new Node.js features.http2Issues and PRs related to the http2 subsystem.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions