You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Is there a good way to track how recently data was received from the remote end of an http2 session? #21730
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?
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.
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?
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.
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.
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.
Activity
davisjam commentedon Jul 10, 2018
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.murgatroid99 commentedon Jul 10, 2018
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 underlyinghttp2session.socket?jasnell commentedon Aug 10, 2018
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.
murgatroid99 commentedon Aug 10, 2018
That timestamp would be all I really need here.
jasnell commentedon Aug 10, 2018
Will investigate the possibilities here. Marking as a feature request.
Trott commentedon Nov 16, 2018
@jasnell Any results to report?
jasnell commentedon Nov 16, 2018
I've got an open pr that I need to revisit in the next few weeks
github-actions commentedon Feb 28, 2022
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.
github-actions commentedon Apr 4, 2022
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.