【问题标题】:Not able to make xmpp connection between my app server and GCM's CCS using XMPPHP library无法使用 XMPPHP 库在我的应用服务器和 GCM 的 CCS 之间建立 xmpp 连接
【发布时间】:2016-05-24 19:14:24
【问题描述】:

像推送通知(下游消息)一样,我想在 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.

【问题讨论】:

    标签: php android google-cloud-messaging xmpp xmpphp


    【解决方案1】:

    这很可能是由于CCS doesn't currently support the STARTTLS extension.我遇到了 elixir 和 hedwig (see here) 的示例问题。

    遗憾的是,我没有足够的 php 知识来检查您的 XMPP 库是否支持此功能,但也许this SO 线程可以帮助您开始使用 CCS 和 PHP。

    【讨论】:

      【解决方案2】:

      Not able to connect my app server to GCM's CCS using XMPPHP 有一个与您的问题类似的问题的答案。当然,如果您不是那里的提问者。我希望它有效。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-06-17
        • 1970-01-01
        • 2013-08-21
        • 2014-04-15
        • 1970-01-01
        • 1970-01-01
        • 2014-06-05
        • 2015-10-29
        相关资源
        最近更新 更多