Interface Stream

All Known Subinterfaces:
Stream.Client, Stream.Server

public interface Stream

A Stream represents a bidirectional exchange of data within a Session.

A Stream maps to an HTTP/3 request/response cycle, and after the request/response cycle is completed, the stream is closed and removed from the Session.

Like Session, Stream is the active part and by calling its API applications can generate events on the stream; conversely, Stream.Client.Listener and Stream.Server.Listener are the passive part, and their callbacks are invoked when events happen on the stream.

The client initiates a stream by sending a HEADERS frame containing the HTTP/3 request URI and request headers, and zero or more DATA frames containing request content.

Similarly, the server responds by sending a HEADERS frame containing the HTTP/3 response status code and response headers, and zero or more DATA frames containing response content.

Both client and server can end their side of the stream by sending a final frame with the last flag set to true, see HeadersFrame(MetaData, boolean) and DataFrame(ByteBuffer, boolean).