Page 1 of 1

[solved] nghttp2 -- closing a GET stream

Posted: Sun Dec 10, 2017 2:17 am
by hassan789
Trying learn http2 using this example:

Code: Select all

https://github.com/espressif/esp-idf/tree/master/examples/protocols/http2_request
A GET stream is opened to a clock API, where the server pushes the time back to the ESP32 every 1 second. How can I close this stream after 5 seconds, without closing the session or the socket?

Any nghttp2 gurus that can help, would be nice.

Thanks :D

Re: nghttp2 -- closing a GET stream

Posted: Sun Dec 10, 2017 4:14 am
by hassan789
Figured it out. Just have to call:

Code: Select all

nghttp2_submit_rst_stream(session, NGHTTP2_FLAG_NONE, frame->hd.stream_id, NGHTTP2_REFUSED_STREAM))
on the nghttp2_on_frame_recv_callback, aka callback_on_frame_recv() in this example.