Structures

The following structures are available globally.

  • The struct that manages the process of upgrading connections from HTTP 1.1 to other protocols.

    Note

    There a single instance of this struct in a server.
    See more

    Declaration

    Swift

    public struct ConnectionUpgrader
  • A struct that holds the reference to the server wide monitoring delegate.

    See more

    Declaration

    Swift

    public struct Monitor
  • ServerOptions allows customization of default server policies, including:

    • requestSizeLimit: Defines the maximum size for the body of an incoming request, in bytes. If a request body is larger than this limit, it will be rejected and the connection will be closed. A value of nil means no limit.
    • connectionLimit: Defines the maximum number of concurrent connections that a server should accept. Clients attempting to connect when this limit has been reached will be rejected. A value of nil means no limit.

    The server can optionally respond to the client with a message in either of these cases. This message can be customized by defining requestSizeResponseGenerator and connectionResponseGenerator.

    Example usage:

    let server = HTTP.createServer()
    server.options = ServerOptions(requestSizeLimit: 1000, connectionLimit: 10)
    
    See more

    Declaration

    Swift

    public struct ServerOptions