Skip to main content

rooms

Creates, updates, deletes, gets or lists a rooms resource.

Overview

Namerooms
TypeResource
Idaws.ivschat.rooms

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringRoom ID, generated by the system. This is a relative identifier, the part of the ARN that uniquely identifies the room. (pattern: <code>[a-zA-Z0-9]+</code>)
namestringRoom name. The value does not need to be unique. (pattern: <code>[a-zA-Z0-9-_]*</code>)
arnstringRoom ARN, from the request (if identifier was an ARN). (pattern: <code>arn:aws:ivschat:[a-z0-9-]+:[0-9]+:room/[a-zA-Z0-9-]+</code>)
create_timestring (date-time)Time when the room was created. This is an ISO 8601 timestamp; note that this is returned as a string.
logging_configuration_identifiersarrayArray of logging configurations attached to the room.
maximum_message_lengthintegerMaximum number of characters in a single message. Messages are expected to be UTF-8 encoded and this limit applies specifically to rune/code-point count, not number of bytes. Default: 500.
maximum_message_rate_per_secondintegerMaximum number of messages per second that can be sent to the room (by all clients). Default: 10.
message_review_handlerobjectConfiguration information for optional message review.
tagsobjectTags attached to the resource. Array of maps, each of the form string:string (key:value).
update_timestring (date-time)Time of the room’s last update. This is an ISO 8601 timestamp; note that this is returned as a string.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_roomselectregionGets the specified room.
list_roomsselectregionGets summary information about all your rooms in the AWS region where the API request is processed. Results are sorted in descending order of updateTime.
create_chat_tokeninsertregion, roomIdentifier, userIdCreates an encrypted token that is used by a chat participant to establish an individual WebSocket chat connection to a room. When the token is used to connect to chat, the connection is valid for the session duration specified in the request. The token becomes invalid at the token-expiration timestamp included in the response. Use the capabilities field to permit an end user to send messages or moderate a room. The attributes field securely attaches structured data to the chat session; the data is included within each message sent by the end user and received by other participants in the room. Common use cases for attributes include passing end-user profile data like an icon, display name, colors, badges, and other display features. Encryption keys are owned by Amazon IVS Chat and never used directly by your application.
create_roominsertregionCreates a room that allows clients to connect and pass messages.
update_roomupdateregion, identifierUpdates a room’s configuration.
delete_messagedeleteregionSends an event to a specific room which directs clients to delete a specific message; that is, unrender it from view and delete it from the client’s chat history. This event’s EventName is aws:DELETE_MESSAGE. This replicates the DeleteMessage WebSocket operation in the Amazon IVS Chat Messaging API.
delete_roomdeleteregionDeletes the specified room.
disconnect_userexecregion, roomIdentifier, userIdDisconnects all connections using a specified user ID from a room. This replicates the DisconnectUser WebSocket operation in the Amazon IVS Chat Messaging API.
send_eventexecregion, roomIdentifier, eventNameSends 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

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Gets the specified room.

SELECT
id,
name,
arn,
create_time,
logging_configuration_identifiers,
maximum_message_length,
maximum_message_rate_per_second,
message_review_handler,
tags,
update_time
FROM aws.ivschat.rooms
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates an encrypted token that is used by a chat participant to establish an individual WebSocket chat connection to a room. When the token is used to connect to chat, the connection is valid for the session duration specified in the request. The token becomes invalid at the token-expiration timestamp included in the response. Use the capabilities field to permit an end user to send messages or moderate a room. The attributes field securely attaches structured data to the chat session; the data is included within each message sent by the end user and received by other participants in the room. Common use cases for attributes include passing end-user profile data like an icon, display name, colors, badges, and other display features. Encryption keys are owned by Amazon IVS Chat and never used directly by your application.

INSERT INTO aws.ivschat.rooms (
roomIdentifier,
userId,
capabilities,
sessionDurationInMinutes,
attributes,
region
)
SELECT
'{{ roomIdentifier }}' /* required */,
'{{ userId }}' /* required */,
'{{ capabilities }}',
{{ sessionDurationInMinutes }},
'{{ attributes }}',
'{{ region }}'
RETURNING
session_expiration_time,
token,
token_expiration_time
;

UPDATE examples

Updates a room’s configuration.

UPDATE aws.ivschat.rooms
SET
identifier = '{{ identifier }}',
name = '{{ name }}',
maximumMessageRatePerSecond = {{ maximumMessageRatePerSecond }},
maximumMessageLength = {{ maximumMessageLength }},
messageReviewHandler = '{{ messageReviewHandler }}',
loggingConfigurationIdentifiers = '{{ loggingConfigurationIdentifiers }}'
WHERE
region = '{{ region }}' --required
AND identifier = '{{ identifier }}' --required
RETURNING
id,
name,
arn,
create_time,
logging_configuration_identifiers,
maximum_message_length,
maximum_message_rate_per_second,
message_review_handler,
tags,
update_time;

DELETE examples

Sends an event to a specific room which directs clients to delete a specific message; that is, unrender it from view and delete it from the client’s chat history. This event’s EventName is aws:DELETE_MESSAGE. This replicates the DeleteMessage WebSocket operation in the Amazon IVS Chat Messaging API.

DELETE FROM aws.ivschat.rooms
WHERE region = '{{ region }}' --required
;

Lifecycle Methods

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

EXEC aws.ivschat.rooms.disconnect_user
@region='{{ region }}' --required
@@json=
'{
"roomIdentifier": "{{ roomIdentifier }}",
"userId": "{{ userId }}",
"reason": "{{ reason }}"
}'
;