Reputation: 198
if the channel does not exist then we create the new private channel
let options: [NSObject:AnyObject] = [
TWMChannelOptionFriendlyName: defaultChannel,
TWMChannelOptionUniqueName: defaultChannel,
TWMChannelOptionType: TWMChannelType.Private.rawValue
]
channels?.createChannelWithOptions(options, completion: { (result,
channel) in
if result.isSuccessful(){
channel.joinWithCompletion({ (result) in
if result.isSuccessful(){ ... }})
Once, the user joins the channel successfully, we send invite to the other user to join the same channel.
availableChannel.members.inviteByIdentity(other_user_name, completion:
{
(result) in
if result.isSuccessful(){ ... })
But for other user how can he get notify when other user send him chat invitation, in sample app of twilio chat i am not getting any response for invitation accept.
Upvotes: 0
Views: 512
Reputation: 2453
When someone invite you to join a channel you get call from delegate method
- (void)chatClient:(TwilioChatClient *)client notificationInvitedToChannelWithSid:(NSString *)channelSid {
[self displayNotificationForChannelSid:channelSid
messagePlaceholder:@"You were invited to channel '%@'."];
}
Upvotes: 0
Reputation: 198
When user created new channel , then all other users who have registered in the same app get notify via the delegate methods that new channel is created.
So, simple solution is create channel name using sender_receiver name, so when receiver called the delegate methods he will check whether its name is present in channel or not, if channel name consist its name then it will join the channel otherwise leave the channel.
Upvotes: 1