Why can't participants query a newly created conversation?

After a conversation is created using the iOS or Android SDKs, it is stored in memory and only written to the local database when the first message is sent. This can only happen after cold sync (the initial sync after authentication) completes.

In other words, when creating a conversation, you must wait for cold syncing to finish, and the conversation must contain at least one message, before it will return in a query.

This can lead to a race condition where the same set of participants might inadvertently create multiple conversations.

To ensure all users in a given conversation are using the same object, you can use distinct conversations. Conversations are distinct by default, and only need to be created when a user is ready to send a message.

Note: Conversations lose their distinct status if the participant list changes (users are added or removed), after which trying to access a distinct conversation will return a new conversation object.


Try to create a conversation with a given user. If a conversation with this user exists, an error will be returned containing the existing conversation. 

NSSet *participants = [NSSet setWithObjects:otherUserID, nil];
NSDictionary *options = @{};
LYRConversation *conversation = [self.layerClient newConversationWithParticipants:participants
if (error && error.code == LYRErrorDistinctConversationExists) {
conversation = error.userInfo[LYRExistingDistinctConversationKey];


Try to create a conversation with a given user. If a conversation with this user exists, an exception will be thrown containing the existing conversation. 

public Conversation getDistinctConversation(String otherUserID){
Conversation conversation = null;
try {
conversation = layerClient.newConversation(otherUserID);
} catch (LayerConversationException e) {
if (e.getType() == LayerException.Type.DISTINCT_CONVERSATION_EXISTS) {
conversation = e.getConversation();
} else {
throw e;
return conversation;



Have more questions? Submit a request