Like push-notification(downstream message), I want to implement upstream messaging from my android device to my app server in php. I am using this XMPPHP library from Github to connect my app server to GCM's CCS. But when I try to execute below code to connect GCM's CCS:
include 'XMPPHP/XMPP.php';
$conn = new XMPPHP_XMPP('gcm-preprod.googleapis.com', 5236, '<myProjectId>@gcm.googleapis.com', '<myApiKey>', 'xmpphp', 'http://myserverdomain', $printlog=true, $loglevel=XMPPHP_Log::LEVEL_INFO);
$conn->autoSubscribe();
$vcard_request = array();
try {
$conn->connect();
...
I am getting following error.
1455354076 [INFO]: Connecting to tls://gcm-preprod.googleapis.com:5236 1455354106 [ERROR]: Could not connect. Could not connect before timeout.
How CCM will know about where(which app server) to send the upstream message? As there is no explanation in provided documentation.
I think you missed the part in the documentation where it says:
You need to specify the SENDER_ID to know which server you are sending to. Sender ID is a project number acquired from the API console
How to handle the upstream message in PHP? As I am using PHP in backend.
This thread might help you. Read the comments in the accepted answer.
It says that in order to use PHP you need to look for a library that supports XMPP protocol.