joinGroup
Feature Introduction
Note
Apply to join a group.
Caution
Based on Group Verification Options, determine the result of applying to join a group.
Relevant Callbacks: onJoinedGroupAdded onGroupMemberAdded onGroupApplicationAdded
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<dynamic> joinGroup({
required String groupID,
String? reason,
String? operationID,
int joinSource = 3,
})
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
groupID | String | Yes | Group ID |
reason | String | No | Request message |
joinSource | int | Yes | Request source 2: By invitation, 3: By search, 4: By QR code |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
~ | ~ | Application successful if no exception is thrown |
Code Example
await OpenIM.iMManager.groupManager.joinGroup(
groupID: '',
reason: '',
joinSource: 2,
);
// todo
Function Prototype
- (void)joinGroup:(NSString *)groupID
reqMsg:(NSString *)reqMsg
joinSource:(OIMJoinType)joinSource
onSuccess:(OIMSuccessCallback)onSuccess
onFailure:(OIMFailureCallback)onFailure;
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
groupID | NSString | Yes | Group ID |
reqMsg | NSString | No | Request message |
joinSource | OIMJoinType | Yes | Joining method |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
onSuccess | OIMSuccessCallback | Success return |
onFailure | OIMFailureCallback | Failure return |
Code Example
[OIMManager.manager joinGroup:@""
reqMsg:nil
onSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void joinGroup(OnBase<String> callBack, String gid, String reason, int joinSource)
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
callBack | OnBase | Yes | Callback interface |
gid | String | Yes | Group ID |
reason | String | No | Request message |
joinSource | int | Yes | JoinSource Request source |
Return Result
Code Example
OpenIMClient.getInstance().groupManager.joinGroup(new OnBase<String>() {
@Override
public void onError(int code, String error) {
}
@Override
public void onSuccess(String data) {
}
}, gid, reason, joinSource);
Function Prototype
IMSDK.joinGroup({
groupID: string;
reqMsg: string;
joinSource: GroupJoinSource;
}, operationID?: string): Promise<WsResponse>
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
groupID | string | Yes | Group ID |
reqMsg | string | Yes | Group application message |
joinSource | GroupJoinSource | Yes | Join method |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse> | Successful callback |
Promise.catch() | Promise<WsResponse> | Failed callback |
Code Example
import { getSDK } from '@openim/wasm-client-sdk';
import { GroupJoinSource } from '@openim/wasm-client-sdk/lib/types/enum';
const IMSDK = getSDK();
IMSDK.joinGroup({
groupID: '',
reqMsg: '',
joinSource: GroupJoinSource.Search,
})
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
IMSDK.asyncApi('joinGroup', operationID: string, {
groupID: string;
reqMsg: string;
joinSource: GroupJoinSource;
}): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, used for problem tracking, should be unique, recommended to use current time and random number |
groupID | string | Yes | Group ID |
reqMsg | string | Yes | Group application message |
joinSource | GroupJoinSource | Yes | Join method |
Return Result
The function is made Promise-like using the
openim-uniapp-polyfill
package. When calling, usethen
andcatch
to determine and handle the successful and failed callbacks.
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<void> | Successful callback |
Promise.catch() | Promise<CatchResponse> | Failed callback |
Code Example
import IMSDK, { GroupJoinSource } from 'openim-uniapp-polyfill';
IMSDK.asyncApi('joinGroup', IMSDK.uuid(), {
groupID: '',
reqMsg: '',
joinSource: GroupJoinSource.Search,
})
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
OpenIMSDKRN.joinGroup({
groupID: string,
reqMsg: string,
joinSource: GroupJoinSource.Search,
}, operationID: string): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
groupID | string | Yes | Group ID |
reqMsg | string | Yes | Group application message |
joinSource | GroupJoinSource | Yes | Join method |
operationID | string | Yes | Operation ID, used for problem location, keep unique, suggest using current time and random number |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<void> | Callback on successful call |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.joinGroup({
groupID: '',
reqMsg: '',
joinSource: GroupJoinSource.Search,
}, 'operationID')
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
public static void JoinGroup(OnBase<bool> cb, string groupId, string reqMsg, JoinSource joinSource, string ex)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
cb | OnBase | Yes | Callback |
groupId | string | Yes | Group ID |
reqMsg | sting | No | Group application message |
cJoinSource | JoinSource | Yes | Join method |
ex | string | Yes | Extension Field |
Return Result
Code Example
IMSDK.JoinGroup((suc,errCode,errMsg)=>{
},groupId,reqMsg,joinSource,ex);