gpt4 book ai didi

php - 无法使用 XMPPHP 库在我的应用服务器和 GCM 的 CCS 之间建立 xmpp 连接

转载 作者:IT王子 更新时间:2023-10-28 23:33:00 26 4
gpt4 key购买 nike

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

最佳答案

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

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

关于php - 无法使用 XMPPHP 库在我的应用服务器和 GCM 的 CCS 之间建立 xmpp 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35382913/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com