What a handler gets: the decoded params, query, payload
and headers (None for a part the endpoint does not declare),
the request, its endpoint and group.
Attributes#
| Attribute | Type | Description |
|---|---|---|
params | P_co | |
query | Q_co | |
payload | B_co | |
headers | H_co | |
request | ServerRequest | |
endpoint | AnyEndpoint | |
group | AnyGroup | |
upgrader | Callable[[object], Effect[SocketService]] | None = field(default=None, repr=False) |
Functions#
__init__#
__init__(params, query, payload, headers, request, endpoint, group, upgrader=None) -> None| Parameter | Type | Description |
|---|---|---|
params | P_co | |
query | Q_co | |
payload | B_co | |
headers | H_co | |
request | ServerRequest | |
endpoint | AnyEndpoint | |
group | AnyGroup | |
upgrader | Callable[[object], Effect[SocketService]] | None = None |
upgrade#
upgrade(headers=None) -> Effect[SocketService]The upgraded connection of an Upgrade endpoint, answering the
101 with headers (encoded by the upgrade's headers schema),
sent once its reader is taken. Beside other successes, a handler that
upgrades returns nothing.
| Parameter | Type | Description |
|---|---|---|
headers | object = None |
Returns Effect[SocketService]
def upgrade(self, headers: object = None) -> Effect[SocketService]:
"""The upgraded connection of an ``Upgrade`` endpoint, answering the
``101`` with ``headers`` (encoded by the upgrade's headers schema),
sent once its reader is taken. Beside other successes, a handler that
upgrades returns nothing."""
if self.upgrader is None:
raise TypeError(f"Endpoint {self.endpoint.identifier!r} declares no Upgrade")
return self.upgrader(headers)