http2 library

This library provides an http/2 interface on top of a bidirectional stream of bytes.

The client and server sides can be created via ClientTransportStream and ServerTransportStream respectively. Both sides can be configured via settings (see ClientSettings and ServerSettings). The settings will be communicated to the remote peer (if necessary) and will be valid during the entire lifetime of the connection.

A http/2 transport allows a client to open a bidirectional stream (see ClientTransportConnection.makeRequest) and a server can open (or push) a unidirectional stream to the client via ServerTransportStream.push.

In both cases (unidirectional and bidirectional stream), one can send headers and data to the other side (via HeadersStreamMessage and DataStreamMessage). These messages are ordered and will arrive in the same order as they were sent (data messages may be split up into multiple smaller chunks or might be combined).

In the most common case, each direction will send one HeadersStreamMessage followed by zero or more DataStreamMessages.

Establishing a bidirectional stream of bytes to a server is up to the user of this library. There are 3 common ways to achive this

* connect to a server via SSL and use the ALPN (SSL) protocol extension
  to negotiate with the server to speak http/2 (the ALPN protocol
  identifier for http/2 is `h2`)

* have prior knowledge about the server - i.e. know ahead of time that
  the server will speak http/2 via an unencrypted tcp connection

* use a http/1.1 connection and upgrade it to http/2

The first way is the most common way and can be done in Dart by using dart:ios secure socket implementation (by using a SecurityContext and including 'h2' in the list of protocols used for ALPN).

A simple example on how to connect to a http/2 capable server and requesting a resource is available at


Settings for a TransportConnection a client can make.
Represents a data message which can be sent over a HTTP/2 stream.
A HTTP/2 header.
Represents a headers message which can be sent over a HTTP/2 stream.
Settings for a TransportConnection a server can make.
Settings for a TransportConnection.
Represents a message which can be sent over a HTTP/2 stream.
Represents a HTTP/2 connection.
Represents a HTTP/2 stream.
Represents a remote stream push.


ActiveStateHandler = void Function(bool isActive)

Exceptions / Errors

An exception thrown when a HTTP/2 stream error occured.
An exception thrown when a HTTP/2 connection error occurred.
An exception thrown by the HTTP/2 implementation.