tcpNoDelay
When true
, OS will attempt to minimize TCP packet delay.
var tcpNoDelay: Bool
When true
, OS will attempt to minimize TCP packet delay.
var tcpNoDelay: Bool
import Vapor
Vapor is a framework for building server applications, APIs and websites in Swift. It provides a safe, performant and scalable foundation for building large complex backends.
struct Configuration
Engine server config struct.
final class HTTPServer
@frozen struct Bool
A value type whose instances are either true
or false
.
init(address: BindAddress, backlog: Int = 256, reuseAddress: Bool = true, tcpNoDelay: Bool = true, responseCompression: ResponseCompressionConfiguration = .disabled, requestDecompression: RequestDecompressionConfiguration = .enabled, supportPipelining: Bool = true, supportVersions: Set<HTTPVersionMajor>? = nil, tlsConfiguration: TLSConfiguration? = nil, serverName: String? = nil, reportMetrics: Bool = true, logger: Logger? = nil, shutdownTimeout: TimeAmount = .seconds(10), customCertificateVerifyCallback: (([NIOSSLCertificate], EventLoopPromise<NIOSSLVerificationResult>) -> Void)? = nil, connectionsPerServerTick: UInt = 256)
init(hostname: String = Self.defaultHostname, port: Int = Self.defaultPort, backlog: Int = 256, reuseAddress: Bool = true, tcpNoDelay: Bool = true, responseCompression: ResponseCompressionConfiguration = .disabled, requestDecompression: RequestDecompressionConfiguration = .enabled, supportPipelining: Bool = true, supportVersions: Set<HTTPVersionMajor>? = nil, tlsConfiguration: TLSConfiguration? = nil, serverName: String? = nil, reportMetrics: Bool = true, logger: Logger? = nil, shutdownTimeout: TimeAmount = .seconds(10), customCertificateVerifyCallback: (([NIOSSLCertificate], EventLoopPromise<NIOSSLVerificationResult>) -> Void)? = nil, connectionsPerServerTick: UInt = 256)
static let defaultHostname: String
static let defaultPort: Int
var address: BindAddress
Address the server will bind to. Configuring an address using a hostname with a nil host or port will use the default hostname or port respectively.
var backlog: Int
Listen backlog.
var connectionsPerServerTick: UInt
The number of incoming TCP connections to accept per “tick” (i.e. each time through the server’s event loop).
@preconcurrency var customCertificateVerifyCallback: (([NIOSSLCertificate], EventLoopPromise<NIOSSLVerificationResult>) -> Void)?
An optional callback that will be called instead of using swift-nio-ssl’s regular certificate verification logic. This is the same as NIOSSLCustomVerificationCallback
but just marked as Sendable
var hostname: String { get set }
Host name the server will bind to.
var logger: Logger
Any uncaught server or responder errors will go here.
var port: Int { get set }
Port the server will bind to.
var reportMetrics: Bool
When true
, report http metrics through swift-metrics
var requestDecompression: RequestDecompressionConfiguration
Request decompression configuration.
var responseCompression: ResponseCompressionConfiguration
Response compression configuration.
var reuseAddress: Bool
When true
, can prevent errors re-binding to a socket after successive server restarts.
var serverName: String?
If set, this name will be serialized as the Server
header in outgoing responses.
var shutdownTimeout: TimeAmount
A time limit to complete a graceful shutdown
var supportPipelining: Bool
When true
, HTTP server will support pipelined requests.
var supportVersions: Set<HTTPVersionMajor>
var tlsConfiguration: TLSConfiguration?
struct RequestDecompressionConfiguration
Supported HTTP decompression options.
struct ResponseCompressionConfiguration
Supported HTTP response compression options.
typealias CompressionConfiguration = ResponseCompressionConfiguration
typealias DecompressionConfiguration = RequestDecompressionConfiguration