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.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- port → int
-
The port this multi-protocol HTTP server runs on.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
{bool force = false}) → Future - Closes this MultiProtocolHttpServer.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
startServing(
void callbackHttp11(HttpRequest), void callbackHttp2(ServerTransportStream), {void onError(dynamic error, StackTrace)?}) → void - Starts listening for HTTP/1.1 and HTTP/2 clients and calls the given callbacks for new clients.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
bind(
Object? address, int port, SecurityContext context, {ServerSettings? settings}) → Future< MultiProtocolHttpServer> -
Binds a new SecureServerSocket with a security
context
atport
andaddress
(see SecureServerSocket.bind for a description of supported types foraddress
).