Kitura-NIO is a SwiftNIO based networking library for Kitura. Kitura-NIO adopts the same API as KituraNet, making the transition from KituraNet to Kitura-NIO seamless. While Kitura-NIO shares some code with Kitura-Net, the core comprising of HTTPServer, ClientRequest/ClientResponse and TLS support have been implemented using SwiftNIO. Kitura-NIO uses NIOSSL for TLS support.
We expect most of our users to require higher level concepts such as routing, templates and middleware. These are not provided in Kitura-NIO. If you want to use those facilities you should be coding at the Kitura level, for this please see the Kitura project. Kitura-NIO, like Kitura-net, underpins Kitura which offers a higher abstraction level to users.
Kitura-NIO 2 has been tested with Swift 5. If you are using Swift 4, please use Kitura-NIO 1. See the release history for details.
- Port Listening
- HTTP Server support (request and response)
- Basic HTTP client support
With Kitura 2.5 and future releases, to run on top of Kitura-NIO (instead of Kitura-Net) all you need to do is set an environment variable called
KITURA_NIO before building your Kitura application:
export KITURA_NIO=1 && swift build
If you have already built your Kitura application using Kitura-Net and want to switch to using
KITURA_NIO, you need to update the package before building:
export KITURA_NIO=1 && swift package update && swift build
Using the environment variable we make sure that only one out of Kitura-NIO and Kitura-Net is linked into the final binary.
Please note that though Kitura-NIO has its own GitHub repository, the package name is
KituraNet. This is because the Kitura-NIO and Kitura-Net are expected to provide identical APIs, and it makes sense if they share the package name too.
Visit www.kitura.io for reference documentation.
Contributing to Kitura-NIO
We'd be more than happy to receive bug reports, enhancement requests and pull requests!
- Clone this repository.
$ git clone https://github.com/IBM-Swift/Kitura-NIO && cd Kitura-NIO
- Build and run tests.
$ swift test
You may also want to run the tests in parallel:
$ swift test --parallel
In some Linux environments, a low open file limit could cause test failures. See this.
We'd really love to hear feedback from you.
This library is licensed under Apache 2.0. The full license text is available in LICENSE.
Help us keep the lights on
2.4.0 - Oct 23, 2019
- Add an API to access the HTTPServer's EventLoopGroup (#225). This was requested for by #224.
- Fix for #227 (also included in #225)
2.3.0 - Oct 8, 2019
- fix: Close active connections while stopping an HTTPServer (#218)
- feat: Ability to limit request size and connection count (#221)
2.2.0 - Jul 29, 2019
- A nasty race condtion related to WebSocket upgrade has been removed (#217)
ClientRequest: HTTP credentials will no longer be included in the
ClientRequest.urlproperty. This is a small behaviour change (#208)
- The creation of
HTTPServerRequestobjects is now permissible only on the
EventLoopon which the underlying HTTP request arrived (#215)
ClientRequest: new request headers added for parity with Kitura-net (#213)
ClientResponse.statusis now updated to reflect the value of
2.1.1 - Jun 5, 2019
- Falling back to building HTTPServerRequest.urlURL using String concatenation instead of URLComponents. This also includes a change to
ClientRequestthat makes sure we don't percent-encode a URL string twice. (https://github.com/IBM-Swift/Kitura-NIO/pull/199)
2.1.0 - May 24, 2019
- Allow Kitura-NIO to only listen on one network address (#205). Kitura listens on every available address/interface. This feature allows Kitura to listen on only on interface (only one network address)