Trigger for Data Streams that sends messages to WebSocket connections
Written by
Updated at August 12, 2024
A trigger for Data Streams sends messages to WebSocket connections when data is sent to a stream.
A trigger for Data Streams requires service accounts to manage the stream and send messages to WebSocket connections. You can use the same service account for both operations.
For more information about creating a trigger for Data Streams, see Creating a trigger for Data Streams that sends messages to WebSocket connections.
Roles required for the proper operation of a trigger for Data Streams
- To create a trigger, you need a permission for the service account under which the trigger executes the operation. This permission comes with the iam.serviceAccounts.user and editor roles or higher.
- For the trigger to fire, service accounts need the following roles:
api-gateway.websocketBroadcaster
for the folder containing the API gateway.yds.admin
for the stream that invokes the trigger when data is sent there.
Format of the message from the trigger for Data Streams
After the trigger fires, it will send a message to WebSocket connections. The message format depends on the source and is an array of messages
:
{
"messages":[
{
"key1":"value1"
},
{
"key2":"value2"
}
]
}