MultiProtocolHttpServer class
Handles protocol negotiation with HTTP/1.1 and HTTP/2 clients.
Given a (host, port) pair and a SecurityContext
, MultiProtocolHttpServer
will negotiate with the client whether HTTP/1.1 or HTTP/2 should be spoken.
The user must supply 2 callback functions to startServing, which:
- one handles HTTP/1.1 clients (called with a
HttpRequest
) - one handles HTTP/2 clients (called with a http2.ServerTransportStream)
Properties
- address → InternetAddress
-
The address this multi-protocol HTTP server runs on.
read-only
- port → int
-
The port this multi-protocol HTTP server runs on.
read-only
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
close(
{bool force: false }) → Future - Closes this MultiProtocolHttpServer. [...]
-
startServing(
void callbackHttp11(HttpRequest request), void callbackHttp2(ServerTransportStream stream), { void onError(dynamic error, StackTrace stack) }) → void - Starts listening for HTTP/1.1 and HTTP/2 clients and calls the given callbacks for new clients. [...]
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited
Static Methods
-
bind(
dynamic address, int port, SecurityContext context, { ServerSettings settings }) → Future< MultiProtocolHttpServer> -
Binds a new
SecureServerSocket
with a securitycontext
atport
andaddress
(seeSecureServerSocket.bind
for a description of supported types foraddress
). [...]