How to provide functionality to search groupchat with quickblox

379 views Asked by At

I want to implement a functionality in a chat app by which user will be able to search a group by its unique provided code. I have used quickblox for implementing chat functionality. so please provide me a way to do that functionality with quickblox.

1

There are 1 answers

1
Badal Shah On

Please check official Document of Quickchat .

SimpleSample-chat_users-ios

They have mention all the detail in their document.

Moreover , Just Download the demo and try to implement.

Group_chat

Before implement Group chat don't forget to read typical setting section.

Typical settings [Functionality in Groupchat]

Authentication: Chat history: you may wish to keep the archive of all public discussion history which is easily supported by QuickBlox. Some platforms will also require you to implement abuse and moderation mechanisms which are also supported both via API and admin panel. File attachments: typically attachments are not supported 1:1 / IM chat: in many applications you may wish to allow users start a private communication with other user Friending: QuickBlox supports friending or adding other users to favourites which you may use in your application - see also [chat: friending / favourite users lists]

start groupchat with creating Dialogue.

Create_new_group_chat_dialog

QBChatDialog *chatDialog = [[QBChatDialog alloc] initWithDialogID:null type:QBChatDialogTypeGroup]; chatDialog.name = @"Chat with Bob, Sam, Garry"; //set according to requirement chatDialog.occupantIDs = @[@(55), @(678), @(22)];

[QBRequest createDialog:chatDialog successBlock:^(QBResponse *response, QBChatDialog *createdDialog) {

} errorBlock:^(QBResponse *response) {

}];

Second step --> Create chatnotification

- (QBChatMessage *)createChatNotificationForGroupChatCreation:(QBDialog *)dialog
{
    // create message:
    QBChatMessage *inviteMessage = [QBChatMessage message];

    NSMutableDictionary *customParams = [NSMutableDictionary new];
    customParams[@"xmpp_room_jid"] = dialog.roomJID;
    customParams[@"name"] = dialog.name;
    customParams[@"_id"] = dialog.ID;
    customParams[@"type"] = @(dialog.type);
    customParams[@"occupants_ids"] = [dialog.occupantIDs componentsJoinedByString:@","];

    // Add notification_type=1 to extra params when you created a group chat 
    //
    customParams[@"notification_type"] = @"1";

    inviteMessage.customParameters = customParams;

    return inviteMessage;
}

...

for (NSString *occupantID in dialog.occupantIDs) {

    QBChatMessage *inviteMessage = [self createChatNotificationForGroupChatCreation:dialog];

    NSTimeInterval timestamp = (unsigned long)[[NSDate date] timeIntervalSince1970];
    customParams[@"date_sent"] = @(timestamp);

    // send notification
    //
    inviteMessage.recipientID = [occupantID integerValue];

    [[QBChat instance] sendSystemMessage:inviteMessage completion:^(NSError * _Nullable error) {

    }];
}

You will receive opponent in this delegate .

- (void)chatDidReceiveSystemMessage:(QBChatMessage *)message
{
}

You can implement required functionality in group-chat with abolve link. Like , Get online users ,Leave group chat dialog , Attachment in group. etc.