For the new(-ish) async
NIO stuff, is there some kind of connection vs business logic separation example out there, like an adaption of the pre-async SMTP example?
I think Hummingbird v2 is a useful example, @Joannis_Orlandos or @adam-fowler might be able to point you at a good location.
Hummingbird is split into three different sections : Server, Application, Router.
The Server
binds to an address and creates child Channels as required. It uses a type conforming to the protocol ServerChildChannel
to define how child channels are setup and how to process the packets coming in and going out.
The Router
defines how HTTP requests are routed to their handlers and returns the responses from those handlers.
The Application
provides the glue between the Server
and the Router
as long as the Server
is outputting and accepting HTTP parts. The Application
doesn't care how the ServerChildChannel
generates those parts, so they can come from a basic HTTP/1.1 connection, HTTP/2, HTTP with WebSocket upgrade or whatever.