2013-10-30 127 views
0

我想實現連接Google Cloud Messaging的XMPP客戶端。使用Google GCM的Xmpp Python客戶端

我拿起圖書館sleekxmpp。

在連接/認證,我的客戶端發送的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的例子都可能被高度讚賞。

+0

我創建了一個Python包一樣。檢查這個鏈接https://github.com/winster/xmppgcm – Winster

回答

0

您必須將USE_SSL標誌設置爲true

xmpp = ClientXMPP('[email protected]', 'API_KEY') 
xmpp.connect(address=('gcm.googleapis.com', 5235), use_ssl=True)