ConnectyCube / connectycube-reactnative-samples

Chat and Video Chat code samples for React Native, ConnectyCube
https://connectycube.com
Apache License 2.0
124 stars 111 forks source link

OnSent is called before onDelivered most of the time #280

Closed UmerQur3shi closed 2 years ago

UmerQur3shi commented 2 years ago

I've implemented the message status/send_state logic according to the sample provided for chat. The issue is that onSent is called after onDelivered most of the time which is causing problem in displaying the corrent current status of a message, how do we avoid onSent being called after onDelivered by the listener?

DaveLomber commented 2 years ago

@UmerQur3shi theoretically speaking it could sometime happen due to network delays

The proper flow to handle it is to check the message status in Redux. If it's already DELIVERED, then ignore it in 'onSent' callback