Protocol

Protocols that OkHttp implements for ALPN selection.

Protocol vs Scheme

Despite its name, java.net.URL.getProtocol returns the scheme (http, https, etc.) of the URL, not the protocol (http/1.1, spdy/3.1, etc.). OkHttp uses the word protocol to identify how HTTP messages are framed.

Entries

Link copied to clipboard

An obsolete plaintext framing that does not use persistent sockets by default.

Link copied to clipboard

A plaintext framing that includes persistent connections.

Link copied to clipboard

The IETF's binary-framed protocol that includes header compression, multiplexing multiple requests on the same socket, and server-push. HTTP/1.1 semantics are layered on HTTP/2.

Link copied to clipboard

Cleartext HTTP/2 with no "upgrade" round trip. This option requires the client to have prior knowledge that the server supports cleartext HTTP/2.

Link copied to clipboard

QUIC (Quick UDP Internet Connection) is a new multiplexed and secure transport atop UDP, designed from the ground up and optimized for HTTP/2 semantics. HTTP/1.1 semantics are layered on HTTP/2.

Link copied to clipboard

HTTP/3 is the third and upcoming major version of the Hypertext Transfer Protocol used to exchange information. HTTP/3 runs over QUIC, which is published as RFC 9000.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Returns a representation of an immutable list of all enum entries, in the order they're declared.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun toString(): String

Returns the string used to identify this protocol for ALPN, like "http/1.1", "spdy/3.1" or "h2".

Link copied to clipboard
fun valueOf(value: String): Protocol

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.