SendEventToProfiles
Sends an event to multiple users with the attached json data.
Service | Operation |
---|---|
event | SEND_EVENT_TO_PROFILES |
Method Parameters
Parameter | Description |
---|---|
toIds | The profile ids of the users to send the event. |
eventType | The user-defined type of the event. |
eventData | The user-defined data for this event encoded in JSON. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string toIds = "[\"profileId1\", \"profileId2\"]";
string eventType = "type1";
string eventData = "{\"someMapAttribute\": \"someValue\"}";
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.EventService.SendEventToProfiles(toIds, eventType, eventData, successCallback, failureCallback);
const char *toIds = "[\"profileId1\", \"profileId2\"]";
const char *eventType = "type1";
const char *eventData = "{\"someMapAttribute\": \"someValue\"}";
_bc.getEventService().sendEventToProfiles(toIds, eventType, eventData, this);
NSString *toIds = @"[\"profileId1\", \"profileId2\"]";
NSString *eventType = @"type1";
NSString *eventData = @"{\"someMapAttribute\": \"someValue\"}";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc eventService] SendEventToProfiles:
toIds:toIds
eventType:eventType
eventData:eventData
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil]
String toIds = "[\"profileId1\", \"profileId2\"]";
String eventType = "type1";
String eventData = "{\"someMapAttribute\": \"someValue\"}";
this; // implements IServerCallback
_bc.getEventService.SendEventToProfiles(toIds, eventType, eventData, 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 toIds = [
"profileId1",
"profileId2"
];
var eventType = "type1";
var eventData = {
"someMapAttribute": "someValue"
};
_bc.event.SendEventToProfiles(toIds, eventType, eventData, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var toIds = [
"profileId1",
"profileId2"
];
var eventType = "type1";
var eventData = {
"someMapAttribute": "someValue"
};
ServerResponse result = await _bc.eventService.SendEventToProfiles(toIds:toIds, eventType:eventType, eventData:eventData);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var toIds = [
"profileId1",
"profileId2"
];
var eventType = "type1";
var eventData = {
"someMapAttribute": "someValue"
};
var eventProxy = bridge.getEventServiceProxy();
var postResult = eventProxy.SendEventToProfiles(toIds, eventType, eventData);
{
"service":"event",
"operation":"SEND_EVENT_TO_PROFILES",
"data":{
"toIds":[
"profileId1",
"profileId2"
],
"eventType":"type1",
"eventData":{
"someMapAttribute":"someValue"
}
}
}
JSON Response
{
"status": 200,
"data": {
"errorProfiles": [],
"errorCount": 0,
"sentCount": 2
}
}