Skip to main content
Version: 5.7.0

AutoJoinGroup

Automatically join an open group (isOpenGroup) that matches the search criteria and has space available.

  • isOpenGroup - the isOpenGroup flag is set on group creation, or via the SetGroupOpen method.

AutoJoinStrategy is defined by enum or constant in most of the client libraries. For those that take a string, these are the valid values:

  • JoinFirstGroup - Joins the first group found that matches the specified criteria.
  • JoinRandomGroup - Finds all groups that matches the specified criteria and then randomly chooses one to join.
ServiceOperation
groupAUTO_JOIN_GROUP

Method Parameters

ParameterDescription
groupTypeNameName of the associated group type
autoJoinStrategySelection strategy to employ when there are multiple matches
dataQueryJsonQuery parameters (optional)

Usage

http://localhost:3000
string groupType = "a-group-type-name";
AutoJoinStrategy autoJoinStrategy = AutoJoinStrategy.JoinRandomGroup;
string dataQueryJson = "{}";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.Group.AutoJoinGroup(groupType, autoJoinStrategy, dataQueryJson, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": {
"gameId": "20595",
"groupId": "fee55a37-5e86-43e8-942e-06bcbe1b701e",
"ownerId": "ee8cad26-16f2-4ef8-9045-3aab84ce6362",
"name": "group-1",
"groupType": "test2",
"createdAt": 1462223553243,
"updatedAt": 1462223553243,
"members": {
"ee8cad26-16f2-4ef8-9045-3aab84ce6362": {
"role": "OWNER",
"attributes": {}
},
"295c510f-507f-4bcf-80e1-ebc73708ec3c": {
"role": "MEMBER",
"attributes": {}
}
},
"pendingMembers": {},
"version": 1,
"data": {},
"isOpenGroup": false,
"defaultMemberAttributes": {},
"memberCount": 2,
"invitedPendingMemberCount": 0,
"requestingPendingMemberCount": 0,
"acl": {
"member": 2,
"other": 1
}
}
}