0

如果频道不存在,那么我们创建新的私人频道

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(){ ... }})

一旦用户成功加入频道,我们就会向其他用户发送加入同一频道的邀请。

availableChannel.members.inviteByIdentity(other_user_name, completion: 
{ 
(result) in
    if result.isSuccessful(){ ... })

但是对于其他用户来说,当其他用户向他发送聊天邀请时,他如何获得通知,在 twilio 聊天的示例应用程序中,我没有收到任何邀请接受的回复。

4

2 回答 2

1

当用户创建新频道时,在同一应用中注册的所有其他用户都会通过委托方法获得新频道创建的通知。

因此,简单的解决方案是使用 sender_receiver 名称创建频道名称,因此当接收者调用委托方法时,他将检查其名称是否存在于频道中,如果频道名称包含其名称,则它将加入频道,否则离开频道。

于 2018-02-21T04:42:05.513 回答
0

当有人邀请您加入频道时,您会收到来自委托方法的电话

- (void)chatClient:(TwilioChatClient *)client notificationInvitedToChannelWithSid:(NSString *)channelSid { [self displayNotificationForChannelSid:channelSid messagePlaceholder:@"You were invited to channel '%@'."]; }

于 2018-02-21T04:47:58.783 回答