React Native Chat Conversations Async Snippet / Best Practise
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:
- Get token from central backend API on app start.
- Instantiate one central conversation client inside redux.
- On ConvesationJoined event fetch all messages for a given conversation (Redux Object looks like state.messages[conversationId] = MessageArray
- 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, ];
- 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
- 55 All Categories
- 4 SIGNAL 2021
- 217 Product Discussions
- 9 Community - Announcements
- 2 Changelog
- 4 Forum UI Updates
- 5 Welcome Guide
- 4 Community - Events
- 1 External Community Events
- 2 Twilio Relay Developer Conference 2021 Mega Thread
- 1 TwilioQuest Contest!
- 21 Inspiration
- 11 Community - Other Discussions
- 1 Community- Twilio Startups