Skip to content

Commit

Permalink
Merge branch 'main' into python-sdk-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sachaarbonel authored Aug 23, 2023
2 parents e80d4c8 + 69efafb commit 4b1630d
Show file tree
Hide file tree
Showing 11 changed files with 1,147 additions and 1,241 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/docusaurus-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Publish Docusaurus to staging
name: Publish Docusaurus

on:
push:
branches:
- main
paths:
- 'docusaurus/video/docusaurus/**'
- '.github/workflows/docusaurus-deploy.yml'

jobs:
push_docusaurus:
Expand All @@ -13,14 +14,15 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node 16
- name: Setup Node 18
uses: actions/[email protected]
with:
node-version: 16
node-version: 18
- name: push
uses: GetStream/push-stream-chat-docusaurus-action@main
with:
target-branch: 'staging'
target-branch: ${{ github.ref == 'refs/heads/main' && 'main' || 'staging' }}
cli-target-branch: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }}
destination-repository-name: 'stream-video-docusaurus'
source-directory: 'docusaurus/video/docusaurus'
env:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += -j$(NPROCS)

CURRENT_VERSION_MAJOR = 1
CURRENT_VERSION_MINOR = 9
CURRENT_VERSION_MINOR = 10
CURRENT_VERSION_BUG = 0

GIT_DESCRIBE := $(shell git describe)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
id: backstage
id: streaming_backstage
sidebar_position: 5
slug: /streaming/backstage
title: Backstage
Expand Down
6 changes: 3 additions & 3 deletions docusaurus/video/docusaurus/docs/api/streaming/hls.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
id: streaming_overview
id: streaming_hls
sidebar_position: 2
slug: /streaming/overview
title: Overview
slug: /streaming/hls
title: HLS
---
30 changes: 30 additions & 0 deletions docusaurus/video/docusaurus/docs/api/webhooks/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,33 @@ sidebar_position: 2
slug: /streaming/events
title: Events
---

Here you can find the list of events are sent to Webhook and SQS.

| Event Type | Description |
|---------------------------------|------------------------------------------------|
| call.accepted | Sent when a user accepts an incoming call |
| call.blocked_user | Sent when a user is blocked |
| call.broadcasting_started | Sent when HLS broadcasting has started |
| call.broadcasting_stopped | Sent when HLS broadcasting is stopped |
| call.created | Sent when a call is created |
| call.ended | Sent when a call is marked as ended |
| call.live_started | Sent when a call goes live |
| call.member_added | Sent when a member is added |
| call.member_removed | Sent when a member is removed |
| call.member_updated | Sent when a member is updated |
| call.member_updated_permission | Sent when permissions are updated for a member |
| call.permission_request | Sent when a user requests access on a call |
| call.permissions_updated | Sent when permissions are updated on a call |
| call.reaction_new | Sent when a reaction is sent on a call |
| call.recording_started | Sent when call recording starts |
| call.recording_stopped | Sent when call recording is stopped |
| call.rejected | Sent when a user rejects an incoming call |
| call.session_ended | Sent when the session has ended |
| call.session_participant_joined | Sent when a user joins a call |
| call.session_participant_left | Sent when a user leaves a call |
| call.session_started | Sent when a call session starts |
| call.unblocked_user | Sent when a user is unblocked |
| call.updated | Sent when a call is updated |

You can find the definition of each events in the OpenAPI spec available [here](https://github.com/GetStream/protocol/blob/main/openapi/video-openapi.yaml)
47 changes: 46 additions & 1 deletion docusaurus/video/docusaurus/docs/api/webhooks/overview.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
---
id: webhooks_overview
sidebar_position: 1
slug: /streaming/overview
slug: /webhooks/overview
title: Overview
---

You can configure your Stream app to send events to your HTTP/webhook and/or to your AWS SQS queue. Webhooks are usually
the simplest way to receive events from your app and to perform additional action based on what happens to your application.

Both SQS and Webhook can be configured from the Stream Dashboard.

## How to implement a webhook handler

Your webhook handler needs to follow these rules:

- accept HTTP POST requests with JSON payload
- be reachable from the public internet. Tunneling services like Ngrok are supported
- respond with response codes from 200 to 299 as fast as possible

Your webhook handler can use the `type` field to handle events based correctly based on their type and payload.

All webhook requests contain these headers:

| Name | Description |
|-------------------|----------------------------------------------------------------------------------------------------------------------|
| X-WEBHOOK-ID | Unique ID of the webhook call. This value is consistent between retries and could be used to deduplicate retry calls |
| X-WEBHOOK-ATTEMPT | Number of webhook request attempt starting from 1 |
| X-API-KEY | Your application’s API key. Should be used to validate request signature |
| X-SIGNATURE | HMAC signature of the request body. See Signature section |

## Security and Performance

We highly recommend following common security guidelines to make your webhook integration safe and fast:

- Use HTTPS with a certificate from a trusted authority
- Verify the "X-Signature" header
- Support HTTP Keep-Alive
- Be highly available
- Offload the processing of the message if possible (read, store, and forget)

## Error Handling

In case of the request failure Stream Chat attempts to retry a request. The amount of maximum attempts depends on the kind of the error it receives:

- Response code is 408, 429 or >=500: 3 attempts
- Network error: 2 attempts
- Request timeout: 3 attempts

The timeout of one request is 6 seconds, and the request with all retries cannot exceed the duration of 15 seconds.

32 changes: 32 additions & 0 deletions docusaurus/video/docusaurus/docs/api/webhooks/sqs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,35 @@ sidebar_position: 1
slug: /streaming/sqs
title: SQS
---

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

An 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 in a queue for your server or other .

## Configuration

You can configure your SQS queue through the Stream Dashboard or programmatically using the REST API. 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:

```json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1459523779000",
"Effect": "Allow",
"Action": [
"sqs:GetQueueUrl",
"sqs:SendMessage",
"sqs:SendMessageBatch",
"sqs:GetQueueAttributes"
],
"Resource": [
"arn:aws:sqs:region:acc_id:queue_name"
]
}
]
}
```
Loading

0 comments on commit 4b1630d

Please sign in to comment.