|
| 1 | +Application level settings control |
| 2 | + |
| 3 | +- The primary storage location |
| 4 | +- Production & Development modes |
| 5 | +- Authentication behaviour |
| 6 | +- Push providers |
| 7 | +- Action handlers webhooks |
| 8 | +- CDN settings |
| 9 | + |
| 10 | +See also the [User Average Response Time](/chat/docs/java/user_average_response_time/) feature for tracking user responsiveness. |
| 11 | + |
| 12 | +The easiest way to edit this is the dashboard. The docs below show how to change it with the API. |
| 13 | + |
| 14 | +### Edge network & Storage Location |
| 15 | + |
| 16 | +Stream runs an edge network of servers around the world. This ensures that when users connect the chat loads quickly. |
| 17 | +We also support offline storage & optimistic UI updates in all SDKs, ensuring a fast user experience. |
| 18 | + |
| 19 | +At the app level you can control the primary region. This is where your data is stored. |
| 20 | +Connections always happen at the edge, but data is stored in this primary region. |
| 21 | + |
| 22 | +### Production & Development Mode |
| 23 | + |
| 24 | +Stream apps can be configured to be either in `development mode` or in `production mode`. You can select which mode your app should be in when you create it in the Stream dashboard, and you can easily switch between modes later on. |
| 25 | + |
| 26 | +When your app is in production mode, certain destructive features in the dashboard are disabled. This prevents you from accidentally deleting user data or disabling mission-critical features. |
| 27 | + |
| 28 | +### Authentication Behaviour |
| 29 | + |
| 30 | +Application level settings allow you to configure settings that impact all the channel types in your app. Our backend SDKs make it easy to change the app settings. You can also change most of these using the CLI or the dashboard. Here's an example on changing the disable_auth_checks setting: |
| 31 | + |
| 32 | +```java |
| 33 | +// disable auth checks, allows dev token usage |
| 34 | +App.update().disableAuthChecks(true).request(); |
| 35 | + |
| 36 | +// re-enable auth checks |
| 37 | +App.update().disableAuthChecks(false).request(); |
| 38 | +``` |
| 39 | + |
| 40 | +These 2 settings are important. Never run with disable_auth_checks or disable_permission_checks in production. |
| 41 | + |
| 42 | +| NAME | DESCRIPTION | DEFAULT | |
| 43 | +| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------- | |
| 44 | +| disable_auth_checks | Disabled authentication. Convenient during testing and allows you to use devTokens on the client side. Should not be used in production. | false | |
| 45 | +| disable_permissions_checks | Gives all users full permissions to edit messages, delete them etc. Again not recommended in a production setting, only useful for development. | false | |
| 46 | + |
| 47 | +## Other app settings |
| 48 | + |
| 49 | +### Push |
| 50 | + |
| 51 | +| NAME | DESCRIPTION | DEFAULT | |
| 52 | +| --------------- | ----------------------------------------------------------------------------------------- | ------- | |
| 53 | +| apn_config | APN config object. See [details](/chat/docs/java#settings-updateapp-request). | | |
| 54 | +| firebase_config | Firebase config object. See [details](/chat/docs/java#settings-updateapp-request). | | |
| 55 | +| huawei_config | Huawei config object. See [details](/chat/docs/java#settings-updateapp-request). | | |
| 56 | +| xiaomi_config | Xiaomi config object. See [details](/chat/docs/java#settings-updateapp-request). | | |
| 57 | +| push_config | Global config object. See [details](/chat/docs/java#settings-updateapp-request). | | |
| 58 | + |
| 59 | +### CDN |
| 60 | + |
| 61 | +| NAME | DESCRIPTION | DEFAULT | |
| 62 | +| ---------------------- | ------------------------------------------------------------------------------------------ | ----------------- | |
| 63 | +| cdn_expiration_seconds | CDN URL expiration time. See [details](/chat/docs/java#settings-updateapp-request). | 1209600 (14 days) | |
| 64 | + |
| 65 | +### Hooks |
| 66 | + |
| 67 | +#### Custom Action Handler and Before Message Send Webhooks |
| 68 | + |
| 69 | +| NAME | DESCRIPTION | DEFAULT | |
| 70 | +| ---------------------------- | --------------------------------------------------------------------------------------------------------------- | ------- | |
| 71 | +| custom_action_handler_url | This webhook reacts to custom /slash commands and actions on those commands/ | - | |
| 72 | +| before_message_send_hook_url | This webhook allows you to modify or moderate message content before sending it to the chat for everyone to see | - | |
| 73 | + |
| 74 | +### Webhooks, SQS, SNS, and pending messages |
| 75 | + |
| 76 | +Webhooks, SQS, SNS, and pending messages async moderation now use the `event_hooks` array configuration. See the [Webhooks](/chat/docs/java/webhooks_overview/) documentation for complete details. |
| 77 | + |
| 78 | +### Moderation & Translation |
| 79 | + |
| 80 | +The following settings allow you to control moderation for your chat: |
| 81 | + |
| 82 | +| NAME | DESCRIPTION | DEFAULT | |
| 83 | +| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- | ------- | |
| 84 | +| image_moderation_labels | Moderation scores returned from the external image moderation API | - | |
| 85 | +| image_moderation_enabled | If image moderation AI should be turned on | - | |
| 86 | +| enforce_unique_usernames | If Stream should enforce username uniqueness. This prevents people from joining the chat as "elonmusk" while "elonmusk" is presenting. | - | |
| 87 | +| auto_translation_enabled | If Stream should automatically translate messages | - | |
| 88 | +| async_url_enrich_enabled | If url enrichment should be done async. It will trigger message.updated event | - | |
| 89 | + |
| 90 | +### File Uploads |
| 91 | + |
| 92 | +You can set restrictions on file uploads by including a `file_upload_config` object. You can set either an inclusive list using `allowed_file_extensions` and `allowed_mime_types` or an exclusive list using `blocked_file_extensions` and `blocked_mime_types` . |
| 93 | + |
| 94 | +The `file_upload_config` object accepts the following fields: |
| 95 | + |
| 96 | +| NAME | DESCRIPTION | Example | Default | |
| 97 | +| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | ------- | |
| 98 | +| allowed_file_extensions | An array of file types that the user can submit. Files with an extension that does not match the values in this array will be rejected. | [".tar", ".png", ".jpg"] | - | |
| 99 | +| blocked_file_extensions | An array of file types that the user can submit. Files with an extension that does not match the values in this array will be rejected. | [".tar", ".png", ".jpg"] | - | |
| 100 | +| allowed_mime_types | An array of file MIME types that the user can submit. Files with an MIME type that does not match the values in this array will be rejected. Must follow the type/ subtype pattern. | ["text/css", "text/plain", "image/png"] | - | |
| 101 | +| blocked_mime_types | An array of file types that the user can submit. Files with an MIME type that does not match the values in this array will be rejected. Must follow the type/ subtype pattern. | ["text/css", "text/plain", "image/png"] | - | |
| 102 | +| size_limit | A number that represents the maximum accepted file size in bytes. In case its 0 the default maximum is used. | 10485760 | 0 | |
| 103 | + |
| 104 | +For example, the following code shows how to block all attempts to upload any files that are not .csv: |
| 105 | + |
| 106 | +```java |
| 107 | +var cfg = App.FileUploadConfigRequestObject |
| 108 | + .builder() |
| 109 | + .allowedFileExtensions(List.of(".csv")) |
| 110 | + .allowedMimeTypes("text/csv") |
| 111 | + .build(); |
| 112 | + |
| 113 | +App.update().fileUploadConfig(cfg).request(); |
| 114 | +``` |
| 115 | + |
| 116 | +### Image Uploads |
| 117 | + |
| 118 | +You can set restrictions on file uploads by including an `image_upload_config` object. You can set either an inclusive list using `allowed_file_extensions` and `allowed_mime_types` or an exclusive list using `blocked_file_extensions` and `blocked_mime_types` . |
| 119 | + |
| 120 | +The `image_upload_config` object accepts the following fields: |
| 121 | + |
| 122 | +| NAME | DESCRIPTION | Example | Default | |
| 123 | +| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- | ------- | |
| 124 | +| allowed_file_extensions | An array of file types that the user can submit. Files with an extension that does not match the values in this array will be rejected. | [".gif", ".png", ".jpg"] | - | |
| 125 | +| blocked_file_extensions | An array of file types that the user can submit. Files with an extension that does not match the values in this array will be rejected. | [".tar", ".tiff", ".jpg"] | - | |
| 126 | +| allowed_mime_types | An array of file MIME types that the user can submit. Files with an MIME type that does not match the values in this array will be rejected. Must follow the type/ subtype pattern. | ["image/jpeg", "image/svg+xml", "image/png"] | - | |
| 127 | +| blocked_mime_types | An array of file types that the user can submit. Files with an MIME type that does not match the values in this array will be rejected. Must follow the type/ subtype pattern. | ["text/css", "text/plain", "image/tiff"] | - | |
| 128 | +| size_limit | A number that represents the maximum accepted file size in bytes. In case its 0 the default maximum is used. | 10485760 | 0 | |
| 129 | + |
| 130 | +For example, the following code shows how to block all attempts to upload any files that are not gif, jpeg, or png files: |
| 131 | + |
| 132 | +```java |
| 133 | +var cfg = App.FileUploadConfigRequestObject |
| 134 | + .builder() |
| 135 | + .allowedFileExtensions(List.of(".gif", ".jpeg", ".png")) |
| 136 | + .allowedMimeTypes("image/gif", "image/jpeg", "image/png") |
| 137 | + .build(); |
| 138 | + |
| 139 | +App.update().imageUploadConfig(cfg).request(); |
| 140 | +``` |
| 141 | + |
| 142 | +> [!NOTE] |
| 143 | +> Stream allowed types for images are: `image/bmp` , `image/gif` , `image/jpeg` , `image/png` , `image/webp` , `image/heic` , `image/heic-sequence` , `image/heif` , `image/heif-sequence` , `image/svg+xml` . Applications can set a more restrictive list, but would not be allowed to set a less restrictive list. |
0 commit comments