disconnectUser method

Future<void> disconnectUser({
  1. required String roomIdentifier,
  2. required String userId,
  3. String? reason,
})

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

May throw AccessDeniedException. May throw PendingVerification. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

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

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

Parameter reason : Reason for disconnecting the user.

Implementation

Future<void> disconnectUser({
  required String roomIdentifier,
  required String userId,
  String? reason,
}) async {
  final $payload = <String, dynamic>{
    'roomIdentifier': roomIdentifier,
    'userId': userId,
    if (reason != null) 'reason': reason,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/DisconnectUser',
    exceptionFnMap: _exceptionFns,
  );
}