RegisterListenersForFriends
Registers the caller for RTT presence updates from friends on the given platform. Can be one of "all", "brainCloud", or "facebook". If bidirectional is set to true, then also registers the targeted users for presence updates from the caller.
| Service | Operation |
|---|---|
| presence | REGISTER_LISTENERS_FOR_FRIENDS |
Method Parameters
| Parameter | Description |
|---|---|
| platform | Presence for friends of the caller on the specified platform. Use "all" or omit for all platforms. |
| bidirectional | Should those profiles be mutually registered to listen to the current profile? |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string platform = "brainCloud";
bool bidirectional = true;
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.PresenceService.RegisterListenersForFriends(platform, bidirectional, successCallback, failureCallback);
const char* platform = "brainCloud";
bool bidirectional = true;
_bc->getPresenceService()->registerListenersForFriends(platform, bidirectional, this);
NSString* platform = @"brainCloud";
bool bidirectional = true;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc presenceService] registerListenersForFriends:platform
bidirectional:bidirectional
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String platform = "brainCloud";
boolean bidirectional = true;
this; // implements IServerCallback
_bc.getPresenceService().registerListenersForFriends(platform, bidirectional, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var platform = "brainCloud";
var bidirectional = true;
_bc.presence.registerListenersForFriends(platform, bidirectional, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var platform = "brainCloud";
var bidirectional = true;
ServerResponse result = await _bc.presenceService.registerListenersForFriends(platform:platform, bidirectional:bidirectional);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var presenceProxy = bridge.getPresenceServiceProxy();
var platform = "brainCloud";
var bidirectional = true;
var postResult = presenceProxy.registerListenersForFriends(platform, bidirectional);
if (postResult.status == 200) {
// Success!
}
{
"service": "presence",
"operation": "REGISTER_LISTENERS_FOR_FRIENDS",
"data": {
"friendPlatform": "brainCloud",
"bidirectional": true
}
}
JSON Response
{
"data": {
"presence": [
{
"user": {
"id": "7630f98e-1236-4ead-88ee-27ce63b2db2c",
"name": "",
"pic": null,
"cxs": [
"22284:fb416888-e76d-425d-a06d-a5529bdba8d9:id58ohotujj893gomctos244al"
]
},
"online": true,
"summaryFriendData": {},
"activity": {
"LOCATION": "POKER_TABLE",
"STATUS": "PLAYING_GAME"
}
}
]
},
"status": 200
}