I want to implement a XMPP Client that connect the Google Cloud Messaging.
I have picked up the library sleekxmpp.
During the connection / authentication, my client sends the first stream required by GCM:
<stream:stream to='gcm.googleapis.com' xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' xml:lang='en' version='1.0'>
But, the library is not able to parse the answer and I get the error:
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...
Any one has an idea why I get this?
Any example of a python XMPP connection to the GCM might be highly appreciated.
You have to set the use_ssl flag to True
xmpp = ClientXMPP('PROJECT_ID@gcm.googleapis.com', 'API_KEY')
xmpp.connect(address=('gcm.googleapis.com', 5235), use_ssl=True)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.