Support

What happens if 2 separate devices create conversations with identical participant sets?

Layer does not impose restrictions on the number of conversations and application can create with the same participant set. By default, a new conversation is marked as "distinct", and if multiple users create a distinct conversation with the same set of participants, then the Layer servers will reconcile the conversations automatically. You don't need to worry about this yourself.

On the other hand, you do have the option to create multiple conversations with the same set of participants. If two users each create non-distinct conversations, then those conversations will be synced across all participants. Here is how you would create non-distinct conversations on iOS and Android:

On iOS:

NSError *errorTopicA = nil; 
LYRConversation *topicA = [layerClient newConversationWithParticipants:[NSSet setWithObject:@"USER-IDENTIFIER"] options:@{LYRConversationOptionsDistinctByParticipantsKey : @(NO) } error:&errorTopicA];

NSError *errorTopicB = nil;
LYRConversation *topicB = [layerClient newConversationWithParticipants:[NSSet setWithObject:@"USER-IDENTIFIER"] options:@{LYRConversationOptionsDistinctByParticipantsKey : @(NO) } error:&errorTopicB];

On Android:

ConversationOptions optionsTopicA = new ConversationOptions().distinct(false);
Conversation topicA = layerClient.newConversation(optionsTopicA, Arrays.asList("USER-IDENTIFIER"));

ConversationOptions optionsTopicB = new ConversationOptions().distinct(false);
Conversation topicB = layerClient.newConversation(optionsTopicB, Arrays.asList("USER-IDENTIFIER"));
Have more questions? Submit a request