ALPNResult

public enum ALPNResult : Equatable

The result of an ALPN negotiation.

In a system expecting an ALPN negotiation to occur, a wide range of possible things can happen. In the best case scenario it is possible for the server and client to agree on a protocol to speak, in which case this will be .negotiated with the relevant protocol provided as the associated value. However, if for any reason it was not possible to negotiate a protocol, whether because one peer didn’t support ALPN or because there was no protocol overlap, we should fallback to a default choice of some kind.

Exactly what to do when falling back is the responsibility of a specific implementation.

  • ALPN negotiation succeeded. The associated value is the ALPN token that was negotiated.

    Declaration

    Swift

    case negotiated(String)
  • ALPN negotiation either failed, or never took place. The application should fall back to a default protocol choice or close the connection.

    Declaration

    Swift

    case fallback
  • Declaration

    Swift

    public static func ==(lhs: ALPNResult, rhs: ALPNResult) -> Bool