SQS

LAST EDIT Sep 16 2021

Stream can send payloads of all events from your application to an Amazon SQS queue you own.

A chat application with a lot of users generates a lots of events. With a standard Webhook configuration, events are posted to your server and can overwhelm unprepared servers during high-use periods. While the server is out, it will not be able to receive Webhooks and will fail to process them. One way to avoid this issue is to use Stream Chat's support for sending webhooks to Amazon SQS.

SQS removes the chance of losing data for Chat events by providing a large, scalable bucket that holds events generated by Steam Chat in a queue for your server or other .

The complete list of supported events is identical to those sent through webhooks and can be found on the Events page.

Configuration

Copied!

You can configure your SQS queue through the Stream Dashboard or using the Dashboard or programmatically using the REST API or an SDK with Server Side Authorization.

Configuring SQS through the Dashboard

Copied!
  1. Open the Dashboard.

  2. Select the App you want to configure from the App dropdown.

  3. Open the Chat dropdown and select Overview .

  4. Scroll down to the Amazon SQS section and enter the following information.

  • SQS URL

  • AWS Key

  • AWS Secret

At this point, you can click Test SQS to have Stream's servers test their connection with SQS and report back.

Configure Programmatically

Copied!

To configure an SQS queue, use a server-side SDK to set the sqs_url, sqs_key & sqs_secret app settings.

SQS Permissions

Copied!

Stream needs the right permissions on your SQS queue to be able to send events to it. If updates are not showing up in your queue add the following permission policy to the queue:

Here's an example list of messages read from your SQS queue:

SQS Best practices and Assumptions

Copied!
  • Set the maximum message size set to 256 KB.

Stream uses batching for updates and tries to include as many messages as possible to reduce network delays. Messages bigger than the maximum message size will be dropped.

  • Set up a dead-letter queue for your main queue.

This queue will hold the messages that couldn't be processed successfully and is useful for debugging your application.