像推送通知(下游消息)一样,我想在 php 中实现从我的 android 设备到我的应用服务器的上游消息传递。
我正在使用 Github 中的这个 XMPPHP 库将我的应用服务器连接到 GCM 的 CCS。但是当我尝试执行下面的代码来连接 GCM 的 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();
...
我收到以下错误。
1455354076 [INFO]: Connecting to tls://gcm-preprod.googleapis.com:5236 1455354106 [ERROR]: Could not connect. Could not connect before timeout.