【问题标题】:Xmpp Python Client with Google GCM带有 Google GCM 的 Xmpp Python 客户端
【发布时间】:2013-10-30 16:03:43
【问题描述】:

我想实现一个连接 Google Cloud Messaging 的 XMPP 客户端。

我已经拿起了库 slimxmpp。

在连接/身份验证期间,我的客户端发送 GCM 所需的第一个流:

<stream:stream to='gcm.googleapis.com' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0'>

但是,库无法解析答案,我得到了错误:

DEBUG    Connecting to [2404:6800:4008:c00::bc]:5235
DEBUG     ==== TRANSITION disconnected -> connected
DEBUG    Starting HANDLER THREAD
DEBUG    Loading event runner
DEBUG    SEND (IMMED): <stream:stream to='gcm.googleapis.com' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0'>
ERROR    Error reading from XML stream.
DEBUG    reconnecting...
DEBUG    SEND (IMMED): </stream:stream>
INFO     Waiting for </stream:stream> from server
DEBUG     ==== TRANSITION connected -> disconnected
DEBUG    connecting...

有人知道我为什么会得到这个吗?

任何 Python XMPP 连接到 GCM 的示例都可能受到高度赞赏。

【问题讨论】:

标签: python xmpp google-cloud-messaging


【解决方案1】:

您必须将 use_ssl 标志设置为 True

xmpp = ClientXMPP('PROJECT_ID@gcm.googleapis.com', 'API_KEY')
xmpp.connect(address=('gcm.googleapis.com', 5235), use_ssl=True)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-06
    • 2014-04-29
    • 2013-10-21
    • 1970-01-01
    • 2015-07-09
    • 2013-08-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多