# Handler


A callable that handles connection lifecycle events.


`Handler=TypeVar(``"Handler", bound=Callable)`


Handlers are registered with `Connection.on_close()` and `Connection.on_error()`. The `Callable` bound ensures that only callables can be registered, while leaving the signature flexible enough for both synchronous and asynchronous handlers.


## See Also

[Connection](Connection.md#gdtest_complete_docstrings.Connection)
