post_to_connection(
connection_id: __string,
*,
config_overrides: Optional[AsyncApiGatewayManagementApiClientConfig] = None,
data: Optional[Data] = None,
) -> None
Sends the provided data to the specified connection.
Parameters:
-
data
(Optional[Data], default:
None
)
–
The data to be sent to the client specified by its connection id.
-
connection_id
(__string)
–
The identifier of the connection that a specific client is using.
Raises:
Source code in docs_src/capo_apigatewaymanagementapi/_services/async_api_gateway_management_api.py
| async def post_to_connection(
self,
connection_id: "capo_apigatewaymanagementapi.types.__string.__string",
*,
config_overrides: Optional[AsyncApiGatewayManagementApiClientConfig] = None,
data: Optional["capo_apigatewaymanagementapi.types.data.Data"] = None,
) -> None:
"""<p>Sends the provided data to the specified connection.</p>
Args:
data: <p>The data to be sent to the client specified by its connection id.</p>
connection_id: <p>The identifier of the connection that a specific client is using.</p>
Raises:
capo_apigatewaymanagementapi.errors.forbidden_exception.ForbiddenException: <p>The caller is not authorized to invoke this operation.</p>
capo_apigatewaymanagementapi.errors.gone_exception.GoneException: <p>The connection with the provided id no longer exists.</p>
capo_apigatewaymanagementapi.errors.limit_exceeded_exception.LimitExceededException: <p>The client is sending more than the allowed number of requests per unit of time or the WebSocket client side buffer is full.</p>
capo_apigatewaymanagementapi.errors.payload_too_large_exception.PayloadTooLargeException: <p>The data has exceeded the maximum size allowed.</p>
capo_apigatewaymanagementapi.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_apigatewaymanagementapi.types.post_to_connection_request.PostToConnectionRequest]",
) -> AsyncOperationResponse[None]:
import capo_apigatewaymanagementapi._operations.api_gateway_management_api.post_to_connection
(
output,
http_response,
) = await capo_apigatewaymanagementapi._operations.api_gateway_management_api.post_to_connection.async_post_to_connection(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("PostToConnection")
)
input_: capo_apigatewaymanagementapi.types.post_to_connection_request.PostToConnectionRequest = {
"connection_id": connection_id
}
if data is not None:
input_["data"] = data
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|