Skip to content

send_event async

send_event(
    room_identifier: RoomIdentifier,
    event_name: EventName,
    *,
    config_overrides: Optional[AsyncivschatClientConfig] = None,
    attributes: Optional[EventAttributes] = None,
) -> SendEventResponse

Sends an event to a room. Use this within your application’s business logic to send events to clients of a room; e.g., to notify clients to change the way the chat UI is rendered.

Parameters:

  • room_identifier (RoomIdentifier) –

    Identifier of the room to which the event will be sent. Currently this must be an ARN.

  • event_name (EventName) –

    Application-defined name of the event to send to clients.

  • attributes (Optional[EventAttributes], default: None ) –

    Application-defined metadata to attach to the event sent to clients. The maximum length of the metadata is 1 KB total.

Raises:

Source code in docs_src/capo_ivschat/_services/async_ivschat.py
async def send_event(
    self,
    room_identifier: "capo_ivschat.types.room_identifier.RoomIdentifier",
    event_name: "capo_ivschat.types.event_name.EventName",
    *,
    config_overrides: Optional[AsyncivschatClientConfig] = None,
    attributes: Optional[
        "capo_ivschat.types.event_attributes.EventAttributes"
    ] = None,
) -> "capo_ivschat.types.send_event_response.SendEventResponse":
    """<p>Sends an event to a room. Use this within your application’s business logic to send events to clients of a room; e.g., to notify clients to change the way the chat UI is rendered.</p>

    Args:
        room_identifier: <p>Identifier of the room to which the event will be sent. Currently this must be an ARN.</p>
        event_name: <p>Application-defined name of the event to send to clients.</p>
        attributes: <p>Application-defined metadata to attach to the event sent to clients. The maximum length of the metadata is 1 KB total.</p>

    Raises:
        capo_ivschat.errors.access_denied_exception.AccessDeniedException: <p/>
        capo_ivschat.errors.pending_verification.PendingVerification: <p/>
        capo_ivschat.errors.resource_not_found_exception.ResourceNotFoundException: <p/>
        capo_ivschat.errors.throttling_exception.ThrottlingException: <p/>
        capo_ivschat.errors.validation_exception.ValidationException: <p/>
        capo_ivschat.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ivschat.types.send_event_request.SendEventRequest]",
    ) -> AsyncOperationResponse[
        "capo_ivschat.types.send_event_response.SendEventResponse"
    ]:
        import capo_ivschat._operations.amazon_interactive_video_service_chat.send_event

        (
            output,
            http_response,
        ) = await capo_ivschat._operations.amazon_interactive_video_service_chat.send_event.async_send_event(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SendEvent")
    )
    input_: capo_ivschat.types.send_event_request.SendEventRequest = {
        "room_identifier": room_identifier,
        "event_name": event_name,
    }
    if attributes is not None:
        input_["attributes"] = attributes

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output