Noze.io is an attempt to carry over the
Node.js
ideas into pure
Swift.
It uses
libdispatch
for event-driven, non-blocking I/O.
Noze.io is built around type-safe back-pressure aware pull-streams
(using Swift generics)
operating on batches of items. Instead of working with just bytes,
deal with batches of Unicode lines or database records or HTML
responses or - you get the idea.
Be efficient: Stream everything and ßatch.
Note: Consider this deprecated. Noze.io works on top of GCD and is overall really inefficient and slow for various reasons. Macro.swift is an effort the eventually rewrite it on top of SwiftNIO.
A focus is to keep the API similar to Node. Not always possible -
Swift is not JavaScript - but pretty close.
It comes with rechargeables included, Noze.io is self-contained and
doesn’t require any extra dependencies.
No extra C modules, pure Swift.
Haz awezome modules such as:
cows,
leftpad,
express, and
redis.
Noze.io works in Cocoa environments as well as on Linux.
It uses Swift 3 or 4 on macOS or tuxOS.
Head over to our Start page
for install instructions.
Is it a good idea? You tell us.
Not sure, but we think it might be,
because:
a)
While Swift looks like JavaScript, it is actually a very
high performance, statically typed and AOT-compiled language,
b)
Code often looks better in Swift, mostly due to the trailing-closure syntax,
c)
No monkey patching while still providing extensions.
There are cons too.
Shows us some code!
There is a reasonably large collection of simple, focused:
Noze.io examples.
But here you go, the “standard” Node example, a
HelloWorld httpd:
import http
http.createServer { req, res in
res.writeHead(200, [ "Content-Type": "text/html" ])
res.end("<h1>Hello World</h1>")
}
.listen(1337)
An echo daemon, just piping the in-end of a socket into its own out-end:
import net
net.createServer { sock in
sock.write("Welcome to Noze.io!\r\n")
sock | sock
}
.listen(1337)
More complex stuff including a
Todo-MVC backend
can be found in the
Noze.io examples.
Like what you see? Head over to our
Start page
to get started.
At
WWDC 2019,
alongside
SwiftUI,
Apple released a new framework called
Combine.
While the API is completely different,
it seems conceptually quite close to what the core of Noze.io provides:
streams of events, with backpressure support and transformations.
Looks like more and more people are looking into
µExpress
in search for a small, approachable and Express like,
SwiftNIO
API.
Yet µExpress was “just” intended as a
tutorial
on how to create a tiny web framework on top of NIO,
not as a standalone library.
Should we do 𝓶Express?
In a surprise move, Apple released
Swift NIO
on March 1st.
The Always Right Institute created a
small tutorial
on how to use that framework.
But how does that fit into Noze.io?
Just a small update on the state of Noze.io in 2018.
What we might be able to do. Or not. And other things of interest.
2016 - the year we announced Noze.io.
Let’s review what happened wrt “Server Side Swift”,
what we accomplished in Noze.io
and consider where we might go in the future.
We are happy to announce a minor Noze.io release: 0.5.2, codenamed
‘Basic Nozes with an End’.
Good news everyone!
We can finally make a release which leaves Swift 2 behind and works with a
Swift 3 on both, macOS and tuxOS. We call that release: 0.5.0
.
Exciting:
Swift 3.0 has been released
last week.
Or not so: the embedded
libdispatch
contains a crasher bug (SR-2656)
which seems to render it useless (for channel based I/O) on Linux.
And in consequence the Noze.io + Swift 3.0 combination on Linux.
Noze.io 0.3.1 is a minor release which just adds two things:
a) compatibility with
Swift 3 Preview 4
on both macOS & tuxOS
and
b) use of the new protocol based http_parser
port.
Noze.io is starting to get persistent. Publish “Hi!” to Redis.
I’m proud to announce the most amazing and magical release yet:
Noze.io 0.2.10 Cows.
With a lot of hard work (and a sweating Swift3 compiler) we managed to include
over
400 very nice cows
into the Noze.io framework.
W
W
D
C week.
WWDC adjustments. Plus some support for HTTP cookies as well as
two rather major bug fixes.
Last week we announced our first public Noze.io v0.2.x branch,
codename “Less than Prefect”, accompanied by the 0.2.3 release.
This week we pushed a 0.2.5 release.
I am pleased to announce the first demo release of Noze.io!