Skip to content

blackbull.server

blackbull.server

Server

An asyncio socket server that dispatches each connection through the app's :class:~blackbull.server.protocol_registry.ProtocolRegistry.

The shared HTTP listener detects HTTP/1.1 vs HTTP/2 (and upgrades to WebSocket); port-bound non-ASGI protocols registered via :meth:BlackBull.raw_handler get their own listening socket (Sprint 50). When ssl_context or certfile is set, the HTTP listener runs as HTTPS.

Formerly ASGIServer — that name remains as a backward-compat alias.

client_connected_cb(reader, writer) async

Accept callback for the shared HTTP listener.

run(port=80) async

Run an asyncio socket server with the setting in this object.

shutdown() async

Drive the ASGI lifespan shutdown handshake.

startup() async

Drive the ASGI lifespan startup handshake.

Launches the app's lifespan task, delivers 'lifespan.startup', and waits for 'lifespan.startup.complete'. Raises RuntimeError on 'lifespan.startup.failed'. Stores the context manager so that shutdown() can deliver 'lifespan.shutdown' to the same task.