I'm trying to use netty
to implement HTTP/2 client. In this example (line 93) they manually increment streamId
and put it to the map. When response comes they look for HttpConversionUtil.ExtensionHeaderNames.STREAM_ID
header parameter and thus associate the response with the request.
I don't like the idea of increasing streamId
by myself. Can I somehow get the id netty's going to use to writeAndFlush
the request?
Also, does it take much resources to create a new stream? Or is it just an identifier?
I'm pretty sure, at this moment you can't get streamId
generated and used by Netty. Also, I don't like the idea of increasing streamId
by myself too, but looks like it's okay to do this with current API.
I've checked Netty sources and found next things:
getStreamId
which is used in write
method for getting value of currentStreamId
. But we doesn't have any access to this variable.getStreamId
method uses another method called incrementAndGetNextStreamId. So, again, we can only increment and get new streamId
value but can't get the current one.Both of these classes marked with annotation @UnstableApi
, so maybe this behavior will be change in the future.
Here's some related links: