Name
response_eval — Process feedback from Google Cloud Messaging
Synopsis
#include "modules/mobility/gcm/gcm.h"
| int **response_eval** (
| closure, | |
| | response, | |
| | msg)
; | |
void * <var class="pdparam">closure</var>
;
gcm_response * <var class="pdparam">response</var>
;
ec_message * <var class="pdparam">msg</var>
;
Description
**Configuration Change. ** This feature is available as of version 3.5.5.
The primary purpose of this hook is to process Google GCM feedback concerning token management. Use this hook instead of the generic http_response_eval hook when you don't care about the HTTP wrappers around the response and are only concerned with the details. If you need the full response, including the headers, then you should use the generic http_response_eval hook.
At this hook point, feedback from Google servers can be handled, including Registration ID related maintenance feedback. Feedback is provided for messages that have been rejected as well as messages that have been accepted.
Note
You should not modify the response at this hook point.
- closure
-
The closure function.
- response
-
The GCM response. For a description of this data type see “gcm_message_response”.
Inspect the response
GCM_ERROR
field of this struct to determine what action to take. The values for this field are as follows:/* Google GCM errors - Reported on 200 HTTP Response */ GCM_NO_ERROR = 0, GCM_UNAVAILABLE = 1, /* 503 HTTP Response */ GCM_MISSING_REGISTRATION = 2, GCM_INVALID_REGISTRATION = 3, GCM_MISMATCH_SENDER_ID = 4, GCM_NOT_REGISTERED = 5, GCM_MESSAGE_TOO_BIG = 6, GCM_INVALID_DATA_KEY = 7, GCM_INVALID_TTL = 8, GCM_INTERNAL_SERVER_ERROR = 9, /* 500 HTTP Response */ GCM_INVALID_PACKAGE_NAME = 10,
You can use the gcm_get_result_error_code API routine to return these error codes by passing the error field (char *) as a parameter.
This hook returns zero or 1. If non-zero, no further hook providers are called.
This hook will be called in the Scheduler
thread.