IOS SDK

In-App Chat iOS SDK

Overview

eRTC SDK is a fully featured enterprise solution for instant messaging framework for iOS. eRTC SDK is fully featured, scalable, flexible and follows the following key principles:

  • Enterprise solutions
  • Full data control
  • Quick integration
  • Firebase Powered by Google Firebase

Features

  • Individual messages
  • Push notifications
  • Text, Image,Video,Audio messages
  • Typing Indicators
  • Delivered and Read receipts
  • Chat history
  • Chat user list
  • Contact details
  • Encryption

How to add eRTC SDK to your iOS project?

  • Add the eRTC SDK development pods to your Podfile.
    use_frameworks!
        pod 'eRTC_SDK_iOS', '~> 0.1.3'
  • Run pod install to get the latest version of the code.
  • Run pod update to get the latest version of the code (optional for pod update).

How to initialize eRTC SDK in app?

Objective C
ERTCConfig *config = [[ERTCConfig alloc] init];
config.nameSpace = @”YOUR_NAME_SPACE”;
config.apiKey = @”YOUR_API_KEY”;
config.environment = 1; // Optional 1-QA, 2-Staging, 3-Production

[[eRTCSDK alloc] initWithConfig:config
withSuccess:^(BOOL isValid, NSString *errMsg) {
  //your code
} andFailure:^(NSError *error) {
  //handle error
}];
Swift
let config = ERTCConfig()
config.nameSpace = NSNumber(value: ”YOUR_NAME_SPACE”)
config.apiKey = NSNumber(value: ”YOUR_API_KEY”)
config.environment = 1 // Optional 1-QA, 2-Staging, 3-Production

eRTCSDK.init(config: config,
withSuccess: { isValid, errMsg in
  //your code
}, andFailure: { error in
  //handle error
})

How to set up Firebase?

  • Go to the Firebase website and sign up
  • Go to the Firebase console and make a new project
  • Click Add project
  • Choose a name and a location
  • Click Settings (the gear icon). On the General tab, click Add Firebase to your iOS app
  • Enter your bundle ID
  • Download the GoogleServices file and add it to the root of your Xcode project

API Documentation

Namespace validation

Objective C
[eRTCSDK validateNameSpaceWithWorkSpaceName:@”YOUR_NAMESPACE”] withSuccess:^(BOOL isValid, NSString *errMsg) {

} andFailure:^(NSError *error) {

}];
Swift
eRTCSDK.validateNameSpace(withWorkSpaceName:YOUR_NAMESPACE”,
withSuccess: { isValid, errMsg in

}, andFailure: { error in

})

User Login

Objective C
NSDictionary *param = @{
  @"loginType": @"email/phone",
  @"appUserId": @"APP_USER_ID",
  @"password": @"PASSWORD",
  @"fcmToken": @"FCM_TOKEN"
};

[[eRTCUserAuthentication sharedInstance] userAuthenticationWithParam:param
 andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

} andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "loginType": "email/phone",
  "appUserId": "APP_USER_ID",
  "password": "PASSWORD",
  "fcmToken": "FCM_TOKEN"
]

eRTCUserAuthentication.sharedInstance().userAuthentication(
withParam: param,
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Change password

Objective C
NSDictionary *param = @{
  @"loginType": @"USER_NAME",
  @"appUserId": @"YOUR_APP_USER_ID",
  @"currentPassword": @"YOUR_CURRENT_PASSWORD",
  @"newPassword": @"YOUR_NEW_PASSWORD"
};

[[eRTCUserAuthentication sharedInstance] changePasswordWithParam:param
 andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "loginType": "USER_NAME",
  "appUserId": "YOUR_APP_USER_ID",
  "currentPassword": "YOUR_CURRENT_PASSWORD",
  "newPassword": "YOUR_NEW_PASSWORD"
]

eRTCUserAuthentication.sharedInstance().changePassword(
withParam: param,
andCompletion: { json, errMsg in

},andFailure: { error in

})

Forgot password

Objective C
NSDictionary *param = @{
  @"loginType": @"YOUR_USER_NAME",
  @"appUserId": @"YOUR_APP_USER_ID"
};

[[eRTCUserAuthentication sharedInstance] forgotPasswordWithParam:param
 andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "loginType": "YOUR_USER_NAME",
  "appUserId": "YOUR_APP_USER_ID"
]

eRTCUserAuthentication.sharedInstance().forgotPassword(
withParam: param,
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Get Chat Users

Objective C
[[eRTCCoreDataManager sharedInstance] fetchChatUserListWithCompletionHandler:^(id ary, NSError *err) {

}];
Swift
eRTCCoreDataManager.sharedInstance().fetchChatUserList(
withCompletionHandler: { ary, err in

})

Get Reaction Users

Objective C
[[eRTCChatManager sharedChatInstance] getChatReationUserListWithMsgId: @"MESSAGE_UNIQUE_ID"
andEmojiCode: @"EMOJI_CODE"
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
eRTCChatManager.sharedChatInstance().getChatReationUserList(
withMsgId: "MESSAGE_UNIQUE_ID",
andEmojiCode: "EMOJI_CODE",
andCompletion: { json, errMsg in

},andFailure: { error in

})

Logout

Objective C
[[eRTCAppUsers sharedInstance] logoutUserWithCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
eRTCAppUsers.sharedInstance().logoutUser(
withCompletion: { json, errMsg in

},andFailure: { error in

})

Update Profile

Objective C
NSDictionary *param = @{
  @"userId" : @"USER_ID",
  @"profileStatus": @"STATUS_STRING",
  @"loginType": @"email"
};

[[eRTCAppUsers sharedInstance] updateUserProfileData:param
 andFileData:PROFILE_IMAGE_BASE64_DATA
 andCompletion:^(id json, NSString * errMsg) {

} andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "userId": "USER_ID",
  "profileStatus": "STATUS_STRING",
  "loginType": "email"
]

eRTCAppUsers.sharedInstance().updateUserProfileData(param,
andFileData: PROFILE_IMAGE_BASE64_DATA,
andCompletion: { json, errMsg in

},andFailure: { error in

})

Get Threads

Objective C
[[eRTCChatManager sharedChatInstance] getActiveThreads:^(id _Nonnull json, NSString * _Nonnull errMsg) {

} andFailure:^(NSError * _Nonnull error) {

}];
Swift
eRTCChatManager.sharedChatInstance().getActiveThreads({ json, errMsg in

}, andFailure: { error in

})

Create Thread

Objective C
NSDictionary *param = @{
  @"recipientAppUserId": @"RECIPIENT_APP_USERID",
  @"sendereRTCUserId": @"SENDER_RTC_USERID",
};

[[eRTCChatManager sharedChatInstance] getChatThreadIDWithParam:param
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "recipientAppUserId": "RECIPIENT_APP_USERID",
  "sendereRTCUserId": "SENDER_RTC_USERID"
]

eRTCChatManager.sharedChatInstance().getChatThreadID(
withParam: param, andCompletion: { json, errMsg in

}, andFailure: { error in

})

Follow/UnFollow Thread

Set follow parameter true or false to follow or unfollow thread

Objective C
NSMutableDictionary * dictMsgFollowUnfollow = [NSMutableDictionary new];
[dictMsgFollowUnfollow setValue:@true/false forKey:@"follow"];
[dictMsgFollowUnfollow setValue:<Message> forKey:@"message"];
[dictMsgFollowUnfollow setValue:<ThreadID> forKey:"thread_id"];
[dictMsgFollowUnfollow setValue:<MessageID> forKey:"message_id"];
[dictMsgFollowUnfollow setValue:@"true" forKey:@"isStarred"];

[[eRTCChatManager sharedChatInstance] followUnFollowChatMessage:dictMsgFollowUnfollow
andCompletion:^(id Nonnull json, NSString * Nonnull errMsg) {

} andFailure:^(NSError * _Nonnull error) {

}];
Swift
var dictMsgFollowUnfollow: [AnyHashable : Any] = [:]
dictMsgFollowUnfollow["follow"] = NSNumber(value: true/false)
dictMsgFollowUnfollow["message"] = <message>
dictMsgFollowUnfollow[“thread_id] = <threadId>
dictMsgFollowUnfollow[“message_id] = <messageId>
dictMsgFollowUnfollow["isStarred"] = "true"

eRTCChatManager.sharedChatInstance().followUnFollowChatMessage(
dictMsgFollowUnfollow,
andCompletion: { , in

}, andFailure: { error in

})

Get Follow Thread

Objective C
NSMutableDictionary * dictMsgFollowThread = [NSMutableDictionary new];
[dictMsgFollowThread setValue:”single” forKey:@"threadType"];
[dictMsgFollowThread setValue:<message> forKey:@"message"];
[dictMsgFollowThread setValue:[NSNumber numberWithInt:20] forKey:@"pageSize"];
[dictMsgFollowThread setValue:”past” forKey:"direction"];
[dictMsgFollowThread setValue:<messageID> forKey:"currentMsgId"];
[dictMsgFollowThread setValue:[NSNumber numberWithInt:1] forKey:@"replyChatId"];
[dictMsgFollowThread setValue:[NSNumber numberWithInt:0] forKey:@"fetchAll"];
[dictMsgFollowThread setValue:[NSNumber numberWithInt:0] forKey:@"incldueCurrent"];
[dictMsgFollowThread setValue:[NSNumber numberWithInt:0] forKey:@"follow"];

[[eRTCChatManager sharedChatInstance] getFollowThreads:dictMsgFollowThread
andCompletion:^(id Nonnull json, NSString * Nonnull errMsg) {

} andFailure:^(NSError * _Nonnull error) {

}];
Swift
var dictMsgFollowThread: [AnyHashable : Any] = [:]
dictMsgFollowThread["threadType"] = “single”
dictMsgFollowThread["message"] = <message>
dictMsgFollowThread[“pageSize”] = 20
dictMsgFollowThread[“direction”] = “past”
dictMsgFollowThread["currentMsgId"] = <messageId>
dictMsgFollowThread["replyChatId"] = <chatId>
dictMsgFollowThread["fetchAll"] = false
dictMsgFollowThread["incldueCurrent"] = false
dictMsgFollowThread["follow"] = false

eRTCChatManager.sharedChatInstance().getFollowThreads(dictMsgFollowThread,
andCompletion: { , in

}, andFailure: { error in

})

Get Messages

Objective C
[[eRTCCoreDataManager sharedInstance] getUserChatHistoryWithThreadID:@”THREAD_ID”
andCompletionHandler:^(id ary, NSError *err) {

}];
Swift
eRTCCoreDataManager.sharedInstance().getUserChatHistory(
withThreadID:"THREAD_ID",
andCompletionHandler: { ary, err in

})

Get ChatThread Messages

Objective C
[[eRTCCoreDataManager sharedInstance] getUserReplyThreadChatHistoryWithThreadID: @”THREAD_ID” withParentID:@”MsgUniqueId”
andCompletionHandler:^(id ary, NSError *err) {

}];
Swift
eRTCCoreDataManager.sharedInstance().getUserReplyThreadChatHistory(
withThreadID: "THREAD_ID",
withParentID: "MsgUniqueId",
andCompletionHandler: { ary, err in

})

Mark as Read

Objective C
NSDictionary *param = @{
  @"eRTCUserId": @"ERTC_USER_ID",
  @"msgStatusEvent": @"MESSAGE_STATUS",
  @"sendereRTCUserId": @"SENDER_ERTC_USER_ID",
  @"msgUniqueId" : @"MESSAGE_UNIQUE_ID",
  @"tenantId" : @"TENANT_ID",
  @"threadId": @"THREAD_ID",
  @"timeStamp": TIMESTAMP
}

[[eRTCChatManager sharedChatInstance] updateMessageWithReadStatus:param];
Swift
let param = [
  "eRTCUserId": "ERTC_USER_ID",
  "msgStatusEvent": "MESSAGE_STATUS",
  "sendereRTCUserId": "SENDER_ERTC_USER_ID",
  "msgUniqueId": "MESSAGE_UNIQUE_ID",
  "tenantId": "TENANT_ID",
  "threadId": "THREAD_ID",
  "timeStamp": "TIMESTAMP"
]

eRTCChatManager.sharedChatInstance().updateMessage(withReadStatus: param)

Message Updates

Objective C
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(your_method:)
name:DidUpdateChatNotification
object:nil];
Swift
NotificationCenter.default.addObserver(
self,
selector: #selector(your_method(_:)),
name: DidUpdateChatNotification,
object: nil)

Block/unblock user

Objective C
NSDictionary *param = @{
  @"appUserId": @"YOUR_APP_USERID",
  @"blockUnblock": @"block/unblock" // block or unblock
}

[[eRTCAppUsers sharedInstance] ContactblockUnblock:param
 andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}] ;
Swift
var param = [
  "appUserId": "YOUR_APP_USERID",
  "blockUnblock": "block/unblock" // block or unblock
]

eRTCAppUsers.sharedInstance().contactblockUnblock(param,
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Mark as favorite

Objective C
[[eRTCCoreDataManager sharedInstance] isMarkFavouriteWithMessageUniqueId:@"MESSAGE_UNIQUEID"
andMarkFavourite:TRUE/FALSE
andCompletionHandler:^(BOOL isMarkFavourite) {

}];
Swift
eRTCCoreDataManager.sharedInstance().isMarkFavourite(
withMessageUniqueId: "MESSAGE_UNIQUEID",
andMarkFavourite: true / false,
andCompletionHandler: { isMarkFavourite in

})

Send Reaction

Objective C
[[eRTCChatManager sharedChatInstance] sendTextReactionWithParam:@"MESSAGE_UNIQUE_ID"
andEmojiCode:@"EMOJI_CODE"
andEmojiAction:@"clear"
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
eRTCChatManager.sharedChatInstance().sendTextReaction(
withParam: "MESSAGE_UNIQUE_ID",
andEmojiCode: "EMOJI_CODE",
andEmojiAction: "clear",
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Forward chat

Objective C
NSArray *details = @[];
[[eRTCChatManager sharedChatInstance] ForwardMultiMessageWithParam:details
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
let details: [AnyHashable]? = []
eRTCChatManager.sharedChatInstance().ForwardMultiMessage(param: details,
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Delete Message

Objective C
NSDictionary *param = @{
  @"msgUniqueId" : @"MESSAGE_UNIQUE_ID",
  @"chats" : @[ @{@"msgUniqueId" : @"MESSAGE_UNIQUE_ID"} ],
  @"threadId" : @"THREAD_ID",
  @"deleteType": @"everyone/self",
  @"msgCorrelationId": [[NSDate date] timeIntervalSince1970]
};

[[eRTCChatManager sharedChatInstance] DeleteMessageWithParam:param
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "msgUniqueId": "MESSAGE_UNIQUE_ID",
  "chats": [["msgUniqueId": "MESSAGE_UNIQUE_ID"]],
  "threadId": "THREAD_ID",
  "deleteType": "everyone/self",
  "msgCorrelationId": Date().timeIntervalSince1970
]

eRTCChatManager.sharedChatInstance().deleteMessage(
withParam: param,
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Edit Message

Objective C
NSDictionary *param = @{
  @"message" : @"UPDATED_MESSAGE_STRING",
  @"threadId" : @"ThreadID",
  @"msgUniqueId": @"MESSAGE_UNIQUE_ID"
};

[[eRTCChatManager sharedChatInstance] editMessageWithParam:param
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "message": "UPDATED_MESSAGE_STRING",
  "threadId": "ThreadID",
  "msgUniqueId": "MESSAGE_UNIQUE_ID"
]

eRTCChatManager.sharedChatInstance().editMessage(
withParam: param,
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Report Message

Objective C
NSMutableDictionary*dictParam = [[NSMutableDictionary alloc]init];
[dictParam setValue:<Reason> forKey:"reason"];
[dictParam setValue:<Category> forKey:"category"];
[dictParam setValue:<Message Id> forKey:"message_id"];

[[eRTCChatManager sharedChatInstance] chatReport:dictParam andCompletion:^(id Nonnull json, NSString * Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
var dictParam: [AnyHashable : Any] = [:]
dictParam["reason"] = <reason>
dictParam["category"] = <categoryId>
dictParam["messege_jd"] = <messageId>

eRTCChatManager.sharedChatInstance().chatReport(dictParam,
andCompletion: { , in

}, andFailure: { error in

})

Undo Report

Objective C
[[eRTCChatManager sharedChatInstance] undoChatReport:
@{@"chatReportId": <chatReportId>}
andCompletion:^(id Nonnull json, NSString * Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
eRTCChatManager.sharedChatInstance().undoChatReport(
["chatReportId": <chatReportId>]
, andCompletion: { , in

}, andFailure: { error in

})

Get Reported Message

Objective C
NSMutableDictionary*dictParam = [[NSMutableDictionary alloc]init];
NSArray *aryCategory = @[@"abuse",@"spam",@"other",@"inappropriate"];
NSArray *aryStatus = @[@"allow", @"ignore", @"new"];
NSArray *aryMsgType = @[@"text",@"gif", @"image", @"audio", @"video", @"file", @"location", @"contact", @"gify", @"sticker"];
[dictParam setValue:aryCategory forKey:"category"];
[dictParam setValue:aryStatus forKey:"status"];
[dictParam setValue:aryMsgType forKey:"message_type"];
[dictParam setValue:@10 forKey:"limit"];
[dictParam setValue:@1 forKey:"skip"];

[[eRTCChatManager sharedChatInstance] getChatReports:dictParam
andCompletion:^(id Nonnull json, NSString * Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
var dictParam: [AnyHashable : Any] = [:]
let aryCategory = ["abuse", "spam", "other", "inappropriate"]
let aryStatus = ["allow", "ignore", "new"]
let aryMsgType = [
"text",
"gif",
"image",
"audio",
"video",
"file",
"location",
"contact",
"gify",
"sticker"
]
dictParam[“cateogory”] = aryCategory
dictParam[“status”] = aryStatus
dictParam[“msg_type”] = aryMsgType
dictParam[“limit] = NSNumber(value: 10)
dictParam[“skip”] = NSNumber(value: 1)

eRTCChatManager.sharedChatInstance().getChatReports(dictParam,
andCompletion: { , in

}, andFailure: { error in

})

Chat Restore

Objective C
NSDictionary *param = @{
  @"pageSize": @10,
  @"currentMsgId": @"YOUR_FIRST_MESSAGE_ID" //optional
  @"direction": @"past/future"
};

[[eRTCChatManager sharedChatInstance] loadPreviousChatHistoryWithThreadID:@"THREAD_ID" parameters:param
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "pageSize": NSNumber(value: 10),
  "currentMsgId": "YOUR_FIRST_MESSAGE_ID" /*optional */,
  "direction": "past/future"
]

eRTCChatManager.sharedChatInstance().loadPreviousChatHistory(
withThreadID: "THREAD_ID",
parameters: param,
andCompletion: { json, errMsg in

},andFailure: { error in

})

Create Group

Objective C
NSDictionary *param = @{
  @"groupType" = @"private",
  @"name" = @"YOUR_GROUP_NAME",
  @"participants" = @[
    @"App_User_ID",
    @"App_User_ID"
  ]
};

[[eRTCChatManager sharedChatInstance] CreatePrivateGroup:param withGroupImage:BASE64_IMAGE_DATA
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "groupType": "private",
  "name": "YOUR_GROUP_NAME",
  "participants": ["App_User_ID", "App_User_ID"]
]

eRTCChatManager.sharedChatInstance().createPrivateGroup(param,
withGroupImage: BASE64_IMAGE_DATA,
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Get all groups

Objective C
[[eRTCChatManager sharedChatInstance]getuserGroups:@{}
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
eRTCChatManager.sharedChatInstance().getuserGroups([:],
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Get group info by groupId

Objective C
NSDictionary *param = @{
  @"groupId" : @"GROUP_ID"
}

[[eRTCChatManager sharedChatInstance]getGroupByGroupId:param
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "groupId": "GROUP_ID"
]

eRTCChatManager.sharedChatInstance().getGroupByGroupId(param,
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Update Group Name

Objective C
NSMutableDictionary*dictParam = [[NSMutableDictionary alloc]init];
[dictParam setValue:<Group Name> forKey:"group_name"];
[dictParam setValue:<Group Id> forKey:"group_id"];

[[eRTCChatManager sharedChatInstance] updateGroup:dictParam
andCompletion:^(id Nonnull json, NSString * Nonnull errMsg) {

} andFailure:^(NSError * _Nonnull error) {

}];
Swift
var dictParam: [AnyHashable : Any] = [:]
dictParam["group_name"] = <group name>
dictParam["group_id"] = <groupId>

eRTCChatManager.sharedChatInstance().updateGroup(dictParam,
andCompletion: { , in

}, andFailure: { error in

})

Update Group Description

Objective C
NSMutableDictionary*dictParam = [[NSMutableDictionary alloc]init];
[dictParam setValue:<Description> forKey:"group_description"];
[dictParam setValue:<Group Id> forKey:"group_id"];

[[eRTCChatManager sharedChatInstance] updateGroup:dictParam
andCompletion:^(id Nonnull json, NSString * Nonnull errMsg) {

} andFailure:^(NSError * _Nonnull error) {

}];
Swift
var dictParam: [AnyHashable : Any] = [:]
dictParam["group_description"] = <descriptioon>
dictParam["group_id"] = <groupId>

eRTCChatManager.sharedChatInstance().updateGroup(dictParam,
andCompletion: { , in

}, andFailure: { error in

})

Update Group Photo

Objective C
NSMutableDictionary* dictParam = [[NSMutableDictionary alloc]init];
NSData *groupProfileData = UIImageJPEGRepresentation(_imgProfile.image, 1.0);
[dictParam setValue:self.dictEditInfo[@"groupId"] forKey:Group_GroupId];

[[eRTCChatManager sharedChatInstance] updateGroup:dictParam
withGroupImage:groupProfileData
andCompletion:^(id Nonnull json, NSString * Nonnull errMsg) {

} andFailure:^(NSError * _Nonnull error) {

}];
Swift
var dictParam: [AnyHashable : Any] = [:]
dictParam[“group_id] = <groupId>
let groupProfileData = imgProfile.image.jpegData(compressionQuality: 1.0)

eRTCChatManager.sharedChatInstance().updateGroup(dictParam,
withGroupImage: groupProfileData,
andCompletion: { , in

}, andFailure: { error in

})

Add participants

Objective C
NSDictionary *param = @{
  @"groupId" = @"GROUP_ID",
  @"participants" = @[
    @"xxx@yourdomain.com",
    @"yyy@yourdomain.com",
  ]
};

[[eRTCChatManager sharedChatInstance]groupAddParticipants:param
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

} andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "groupId": "GROUP_ID",
  "participants": [
    "xxx@yourdomain.com",
    "yyy@yourdomain.com"
  ]
]

eRTCChatManager.sharedChatInstance().groupAddParticipants(param,
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Remove participants

Objective C
NSDictionary *param = @{
  @"groupId" = @"GROUP_ID",
  @"participants" = @[
    @"xxx@yourdomain.com",
    @"yyy@yourdomain.com",
  ]
};

[[eRTCChatManager sharedChatInstance]groupRemoveParticipants:param
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "groupId": "GROUP_ID",
  "participants": [
    "xxx@yourdomain.com",
    "yyy@yourdomain.com"
  ]
]

eRTCChatManager.sharedChatInstance().groupRemoveParticipants(param,
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Add admin

Objective C
NSDictionary *param = @{
  @"action" = @"make",
  @"eRTCUserId" = @"ERTC_USER_ID",
  @"groupId" = @"GROUP_ID",
  @"targetAppUserId" = @"APP_USER_ID"
};

[[eRTCChatManager sharedChatInstance]groupmakeDismissAdmin:param
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "action": "make",
  "eRTCUserId": "ERTC_USER_ID",
  "groupId": "GROUP_ID",
  "targetAppUserId": "APP_USER_ID"
]

eRTCChatManager.sharedChatInstance().groupmakeDismissAdmin(param,
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Remove admin

Objective C
NSDictionary *param = @{
  @"action" = @"dismiss",
  @"eRTCUserId" = @"ERTC_USER_ID",
  @"groupId" = @"GROUP_ID",
  @"targetAppUserId" = @"APP_USER_ID"
};

[[eRTCChatManager sharedChatInstance]groupmakeDismissAdmin:param
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "action": "dismiss",
  "eRTCUserId": "ERTC_USER_ID",
  "groupId": "GROUP_ID",
  "targetAppUserId": "APP_USER_ID"
]

eRTCChatManager.sharedChatInstance().groupmakeDismissAdmin(param, andCompletion: { json, errMsg in

}, andFailure: { error in

})

Exit group

Objective C
NSDictionary *param = @{
  @"groupId" = @"GROUP_ID",
  @"participants" = @[
    @"CURRENT_USER_LOGIN_ID"
  ]
};

[[eRTCChatManager sharedChatInstance]groupRemoveParticipants:param
andCompletion:^(id _Nonnull json, NSString * _Nonnull errMsg) {

}andFailure:^(NSError * _Nonnull error) {

}];
Swift
let param = [
  "groupId": "GROUP_ID",
  "participants": [
    "CURRENT_USER_LOGIN_ID"
  ]
]

eRTCChatManager.sharedChatInstance().groupRemoveParticipants(param,
andCompletion: { json, errMsg in

}, andFailure: { error in

})

Typing indicator subscription

Objective C
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(your_controller_method:)
name:DidRecievedTypingStatusNotification
object:nil];
Swift
NotificationCenter.default.addObserver(
self,
selector: #selector(your_controller_method(_:)),
name: DidRecievedTypingStatusNotification,
object: nil)

Typing indicator publish

Objective C
NSDictionary *param = @{
  @"appUserId" = @"CUREENT_APP_USERID",
  @"eRTCUserId" = @"CUREENT_USER_LOGINID",
  @"typingStatusEvent" = @"on/off"
};

[[eRTCChatManager sharedChatInstance] sendTypingStatus:param];
Swift
let param = [
  "appUserId": "CUREENT_APP_USERID",
  "eRTCUserId": "CUREENT_USER_LOGINID",
  "typingStatusEvent": "on/off"
]

eRTCChatManager.sharedChatInstance().sendTypingStatus(param)

Resources

The Chat SDK is broken down into the following major parts:

  • Core: This includes definitions and common services and functions.
  • CoreData: This stores all the user data, thread and message data.
  • ChatManager: This component handles communication with the network.
  • SocketManager: This component handles real-time communication via MQTT.