Server¶
Runs an HTTP server.
Server operation¶
Information flow into the Server is as follows:
-
Server
listens for incoming TCP connections. -
_ServerConnHandler
is the notification class for new connections. It creates a_ServerConnection
actor and receives all the raw data from TCP. It uses theHTTP11RequestParser
to assemble completeRequest
objects which are passed off to the_ServerConnection
. -
The
_ServerConnection
actor deals with requests and their bodies that have been parsed by theHTTP11RequestParser
. This is where requests get dispatched to the caller-provided Handler.
Implements¶
- _SessionRegistry tag
Constructors¶
create¶
Create a server bound to the given host and service. To do this we listen for incoming TCP connections, with a notification handler that will create a server session actor for each one.
new tag create(
auth: TCPListenAuth val,
notify: ServerNotify iso,
handler: HandlerFactory val,
config: ServerConfig val,
sslctx: (SSLContext val | None val) = reference)
: Server tag^
Parameters¶
- auth: TCPListenAuth val
- notify: ServerNotify iso
- handler: HandlerFactory val
- config: ServerConfig val
- sslctx: (SSLContext val | None val) = reference
Returns¶
- Server tag^
Public Behaviours¶
register_session¶
Parameters¶
- conn: _ServerConnection tag
unregister_session¶
Parameters¶
- conn: _ServerConnection tag
set_handler¶
Replace the request handler.
Parameters¶
- handler: HandlerFactory val
dispose¶
Shut down the server gracefully. To do this we have to eliminate any source of further inputs. So we stop listening for new incoming TCP connections, and close any that still exist.
Public Functions¶
local_address¶
Returns the locally bound address.
Returns¶
- NetAddress val