Anand
Anand

Reputation: 5332

Create One to One Chat in Sendbird IOS

I was trying to create a chat application using SendBirdSDK. But I couldn't find any methods in the documentation to start chat with a user. I downloaded the sample project and checked it, but it contains group channels and open channels only.

Is there any such methods to create 1 to 1 messages or should I need to create a groupchat with single user ID only?

Any help will be apreciated

Upvotes: 2

Views: 2622

Answers (2)

terryk
terryk

Reputation: 116

According to the documentation,

A Group Channel is a private chat. A user may join the chat only through an invitation by another user who is already a member of the chatroom. A Group Channel can consist of one to hundreds of members. Creating a channel with two members allows 1-to-1 messaging.

So you just need to create a Group Channel with two User IDs in order it to be a 1-to-1 chat. Also, you should enable the Distinct property, because also according to the docs:

Consequently, we recommend that you enable the Distinct property in 1-to-1 messaging channels in order to reuse the same channel when a user chooses to directly message a friend. If the property is disabled, the user will create a new channel even if they have had previous conversations with the friend, and therefore will not be able to see or access previously sent messages or data.

Reference: https://docs.sendbird.com/ios#group_channel_3_creating_a_group_channel

Upvotes: 3

Moin Shirazi
Moin Shirazi

Reputation: 4425

I am not sure but in group channel they provide 1-on-1 messaging. But for that you need to create a group with other userID

You can use the reference code from here:

https://sendbird.gitbooks.io/how-to-build-an-ios-messaging-app/content/en/implement_1-on-1_messaging.html

Upvotes: 0

Related Questions