talira

SwiftNIO

Event-driven network application framework for high performance protocol servers and clients

open sourceApache-2.0free

SwiftNIO is Apple's cross-platform, asynchronous, event-driven network application framework for building high-performance protocol servers and clients in Swift, like Netty but for Swift. Its core gives event loops, channels and channel pipelines (NIOCore), a high-performance non-blocking I/O layer for POSIX systems (NIOPosix) and an embedded channel for testing, plus low-level HTTP/1.1 and WebSocket implementations; companion repositories add TLS (swift-nio-ssl), HTTP/2, SSH, extras, Network.framework transport for Apple platforms, and QUIC and HTTP/3 in development. Higher-level libraries such as AsyncHTTPClient, gRPC Swift, PostgresNIO and RediStack do their I/O on it. It's developed and tested on macOS and Linux, supports iOS, tvOS and watchOS through its transport services, has experimental OpenBSD support, is a graduated Swift Server Workgroup project, and is Apache-2.0 licensed.

Problems it solves

  • build a high-performance network server in Swift
  • write a custom TCP protocol client in Swift without blocking threads
  • run Swift networking code on Linux servers as well as macOS

Features

  • event loops, channels and channel pipelines
  • non-blocking POSIX I/O layer
  • HTTP/1.1 and WebSocket protocol implementations
  • TLS, HTTP/2 and SSH in companion packages
  • embedded channel for testing protocol code
  • async file system APIs