Skip to content

disconnect_user

disconnect_user(
    room_identifier: RoomIdentifier,
    user_id: UserID,
    *,
    config_overrides: Optional[ivschatClientConfig] = None,
    reason: Optional[Reason] = None,
) -> DisconnectUserResponse

Disconnects all connections using a specified user ID from a room. This replicates the DisconnectUser WebSocket operation in the Amazon IVS Chat Messaging API.

Parameters:

  • room_identifier (RoomIdentifier) –

    Identifier of the room from which the user's clients should be disconnected. Currently this must be an ARN.

  • user_id (UserID) –

    ID of the user (connection) to disconnect from the room.

  • reason (Optional[Reason], default: None ) –

    Reason for disconnecting the user.

Raises:

Source code in docs_src/capo_ivschat/_services/ivschat.py
def disconnect_user(
    self,
    room_identifier: "capo_ivschat.types.room_identifier.RoomIdentifier",
    user_id: "capo_ivschat.types.user_id.UserID",
    *,
    config_overrides: Optional[ivschatClientConfig] = None,
    reason: Optional["capo_ivschat.types.reason.Reason"] = None,
) -> "capo_ivschat.types.disconnect_user_response.DisconnectUserResponse":
    """<p>Disconnects all connections using a specified user ID from a room. This replicates the <a href="https://docs.aws.amazon.com/ivs/latest/chatmsgapireference/actions-disconnectuser-publish.html"> DisconnectUser</a> WebSocket operation in the Amazon IVS Chat Messaging API.</p>

    Args:
        room_identifier: <p>Identifier of the room from which the user's clients should be disconnected. Currently this must be an ARN.</p>
        user_id: <p>ID of the user (connection) to disconnect from the room.</p>
        reason: <p>Reason for disconnecting the user.</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.
    """

    def _handler(
        req: "OperationRequest[capo_ivschat.types.disconnect_user_request.DisconnectUserRequest]",
    ) -> OperationResponse[
        "capo_ivschat.types.disconnect_user_response.DisconnectUserResponse"
    ]:
        import capo_ivschat._operations.amazon_interactive_video_service_chat.disconnect_user

        output, http_response = (
            capo_ivschat._operations.amazon_interactive_video_service_chat.disconnect_user.disconnect_user(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_ivschat.types.disconnect_user_request.DisconnectUserRequest",
    ) -> dict[str, Any]:
        import capo_ivschat.types.disconnect_user_request

        return capo_ivschat.types.disconnect_user_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("DisconnectUser", redact_input=_redact_input),
    )
    input_: capo_ivschat.types.disconnect_user_request.DisconnectUserRequest = {
        "room_identifier": room_identifier,
        "user_id": user_id,
    }
    if reason is not None:
        input_["reason"] = reason

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output