Kitura-NIO is a SwiftNIO based networking library for Kitura. Other than an additive change to the HTTPServer API around IPv6 support, Kitura-NIO adopts the same API as KituraNet, making the transition to using the NIO port almost 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.
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 works with Swift 4.1. It is also being tested with the development binaries for Swift 4.2.
- Port Listening
- HTTP Server support (request and response)
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 appilication:
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 make 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
In some Linux environments, this issue may be experienced.
These are early days for Kitura-NIO. We'd really love to hear feedback from you.
This library is licensed under Apache 2.0. Full license text is available in LICENSE.
Help us keep the lights on
v1.0.5 - Sep 17, 2018
- Remove all but one fatalError invocations from Kitura-NIO (#90)
- A bug fix related to the default HTTP version, we now default to 1.1 if the request has no version info (#88)
- Some refactoring and code cleanup (#88, #89)
v1.0.4 - Sep 6, 2018
- A significant bug-fix around multiple writes to an
- Some refactoring to reduce code duplication (#83, #85, #86)
v1.0.3 - Aug 29, 2018
- Moving the Kitura router invocation from the event loop to a dispatch queue (#78)
- Moving ClientRequest.end to a dispatch queue, avoiding wait() calls on the event loop (#79)
- Fixing a thread leak by shutting down the event loop group created by ClientRequest (#76)
- Eliminate zlib linker failures on Ubuntu 16.04 docker images(#77)
- Set SO_REUSEADDR on socket channels to avoid bind errors in Kitura-NIO and Kitura tests (#82)
v1.0.0 - Aug 18, 2018
- KituraNIO renamed to KituraNet
- Better handling of WebSocket upgrade errors