React Native Chat Conversations Async Snippet / Best Practise

Hi all,

we are using Conversations in our app as a chat platform in a group chat setting.

To avoid loading the conversations' messages on demand, I use redux for a global state management.

My flow right now is this:

  1. Get token from central backend API on app start.
  2. Instantiate one central conversation client inside redux.
  3. On ConvesationJoined event fetch all messages for a given conversation (Redux Object looks like state.messages[conversationId] = MessageArray
  4. Attach the messageAdded event to said conversation and update the redux state on event like this
state.messages[convesationId] = [
        ...state.messages[convesationId],
        action.payload.msg,
      ];
  1. fetch messages in the chat view with a conversation proxy similar to the JS SDK react example.

However in the twilio example there is a strong delay between fetching and display of the messages.

I want to send my messages in an async way similar to whatsapp:
User sends message - message gets added to flatlist and at the same time sendMessage() is called - message delivery is updated in a little icon.

Are there any code snippets from twilio that facilitate something like that?

Thanks and all the best

If this is an emergency, please contact Twilio Support. This is not an official Support channel. https://support.twilio.com/
Have an urgent question?
Please contact Twilio Support. This is not an official Support channel.
Contact Support