API reference¶
Use serve() with a Config for the standard server entrypoint, or Server to embed one worker in an existing event loop. Static type annotations and ASGI message contracts live in h2corn.types, and closed-stream send failures raise SendAfterCloseError.
| Page | Use it for |
|---|---|
| Server entrypoints | Start a standalone server, embed one in an event loop, or catch SendAfterCloseError. |
| Configuration types | Construct Config, RequestPolicy, and option literal types in h2corn.types. |
| ASGI applications and aliases | Annotate applications, factories, and send/receive callables from h2corn.types. |
| Scopes and extensions | Work with headers, state, protocol versions, and extension metadata. |
| HTTP scope and messages | Handle requests, responses, trailers, and file sending. |
| WebSocket scope and messages | Accept connections, exchange messages, and close sessions. |
| Lifespan scope and messages | Handle application startup and shutdown. |
For per-option descriptions, defaults, environment variables, and CLI flags, see the Configuration reference.