You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
React Native Chat SDK provides featurerich components which caters to all the types of chat messaging applications.
10
-
Although some of the features or components may come with performance cost, which you will want to avoid for the cases of high
11
-
concurrency applications such as livestreaming. In this guide we have noted down some tips for improving the performance of your
9
+
React Native Chat SDK provides feature-rich components which cater to all types of chat messaging applications.
10
+
Some of the features or components may come with a performance costyou will want to avoid for high
11
+
concurrency applications such as livestreaming. In this guide, we have noted down some tips for improving the performance of your
12
12
chat application if you are expecting heavy traffic on your chat.
13
13
14
14
## Channel Settings
15
15
16
16
Within each channel type, some settings are available that apply to all channels of that type.
17
-
Among these settings are the ability to enable/disable each event type.
18
-
When disabled, events of that type (for channels of this type) will not be passed through to a client's open WebSocket connection.
19
-
It's also important to note that increasing the events enabled on a channel type also increases the load on clients in those channels.
17
+
Among these settings is the ability to enable or disable each event type.
18
+
While disabled, an event of a selected type will not be passed through to a client's open WebSocket connection in the channel type it has been set.
19
+
It's also important to note that increasing the number of enabled events for a channel type also increases the load on clients in those channels.
20
20
21
-
- For Livestream type channels, we recommend disabling Connect, Read Events, and Typing Events. These will cause performance issues and don't generally add to the user experience in these use cases.
21
+
- For the Livestream channel type, we recommend disabling Connect, Read Events, and Typing Events. These will cause performance issues and don't generally add to the user experience in these use cases.
22
22
- Also consider using [Slow Mode](https://getstream.io/chat/docs/slow_mode/?language=js#channel-slow-mode) for Livestream events.
23
23
24
24
<imgsrc={channelSettings} />
25
25
26
26
## State update throttling
27
27
28
-
[Channel](../core-components/channel.mdx) component updates its internal react state based on chat related events received from websocket.
29
-
By default these state updates are throttled to once per 500 ms. For high traffic applications, you may want to adjust throttling
30
-
interval to a higher number. You can configure throttle interval via props on Channel component:
31
-
32
-
-`newMessageStateUpdateThrottleInterval` prop adjusts the throttling interval for state updates when new messages arrive in chat.
33
-
-`stateUpdateThrottleInterval` prop adjusts the throttling interval for state updates for all the other updates to channel except new message.
34
-
35
-
We recommend following configuration, but you can adjust it as per your requirement.
28
+
The [Channel](../core-components/channel.mdx) component updates its internal react state based on chat related events received from the websocket.
29
+
30
+
By default, these state updates are throttled to once per 500 ms. For high-traffic applications, you may want to adjust the throttling interval to a higher number. You can configure throttle interval via the following props on the Channel component:
31
+
32
+
- The `newMessageStateUpdateThrottleInterval` prop adjusts the throttling interval for state updates when new messages arrive in chat.
33
+
34
+
- The `stateUpdateThrottleInterval` prop adjusts the throttling interval for state updates for all the other updates to a channel except new message.
35
+
36
+
We recommend the following configuration, but you can adjust it to fit the requirements of your application.
36
37
37
38
```tsx
38
39
<Channel
@@ -43,36 +44,36 @@ We recommend following configuration, but you can adjust it as per your requirem
43
44
44
45
:::note
45
46
- These props are available in version >= v3.9.0
46
-
- Changes to `stateUpdateThrottleInterval` will result in delays in adding a reaction to message. So try not to keep too high value for this prop.
47
+
- Changes to `stateUpdateThrottleInterval` will result in delays in adding a reaction to a message. Therefore, you should avoid setting the value too high.
47
48
:::
48
49
49
50
## Heavy UI features
50
51
51
-
You can relieve the JS thread by disabling some of the heavy features as mentioned below.
52
+
You can lighten the load for the JS thread by disabling some of the heavier features mentioned below.
52
53
53
54
:::note
54
55
These props are available in version >= v3.9.0
55
56
:::
56
57
57
58
### Image Viewer
58
59
59
-
By default, when you open (or press on) an image attachment, it opens the image in full screen image viewer.
60
-
And within the viewer, you can keep swiping left to scroll through all the images within channel (which have been loaded so far).
61
-
This creates quite a lot of extra work for JS thread in terms of keeping track of image attachments loaded in channel and pre-populating them in the viewer
62
-
for smooth transitions.
60
+
By default, when you open (press) an image attachment it opens the image in a full-screen image viewer.
61
+
Within the viewer, you can keep swiping left to scroll through all the images that have been loaded within a channel so far.
62
+
This creates quite a lot of extra work for the JS thread to keep track of image attachments loaded in a channel and pre-populating them in the viewer for smooth transitions.
63
63
64
-
Since v3.9.0 we have introduced an alternate UX for image viewer, where image attachments of only the selected messages will be loaded in the viewer.
65
-
You can enable this alternate UX by setting a prop `legacyImageViewerSwipeBehaviour`as false on Channel component.
64
+
In v3.9.0, we introduced an alternate UX for the image viewer where image attachments are only loaded for the selected messages in a viewer.
65
+
You can enable this alternate UX by setting the prop `legacyImageViewerSwipeBehaviour`to false on a Channel component.
By default MessageList component renders sticky date header a the top, and date separators in between messages from different dates.
74
-
Computation and insertion of these dates can be heavy for message list when there are lot of messages in channel, since it involves iterating
75
-
through the entire list. For livestream applications we would recommend disabling these features using following two props on Channel component.
73
+
By default, the MessageList component renders a sticky date header at the top of the list, and date separators between messages from different dates.
74
+
Computation and insertion of these dates can be heavy for a message list when there are a lot of messages in the channel since it involves iterating through the entire list.
75
+
76
+
For livestream applications, we would recommend disabling these features using the following two props on a Channel component:
76
77
77
78
```tsx
78
79
<Channel
@@ -83,8 +84,9 @@ through the entire list. For livestream applications we would recommend disablin
83
84
84
85
### Message grouping
85
86
86
-
Messages from same user are grouped by default in the MessageList component. Computations of these groups involves iterating through entire list of messages,
87
-
and thus can be heavy if length of message list is too long. You can disable this feature by setting `enableMessageGroupingByUser` prop as false on Channel component.
87
+
Messages from the same user are grouped by default in the MessageList component. Creating these groups involves iterating through the entire list of messages and thus can be heavy if the length of the message list is too long.
88
+
89
+
You can disable this feature by setting the `enableMessageGroupingByUser` prop to false on a Channel component.
0 commit comments