Closed azmeuk closed 8 years ago
I have tried to connect FCM server using SleekXMPP, it has an issue at connecting FCM server using TLS protocol, you may need to change the TLS to SSL, as the code below.
FCM_SERVER_URL = "fcm-xmpp.googleapis.com"
FCM_SERVER_PORT = 5235
FCM_SECRET = "SERVER-KEY"
FCM_JID = "SENDER-ID@gcm.googleapis.com"
import logging, socket
from sleekxmpp.clientxmpp import ClientXMPP
class ClientComponent(ClientXMPP):
def __init__(self):
ClientXMPP.__init__(self, FCM_JID, FCM_SECRET)
self.auto_reconnect = False
server_ip = socket.gethostbyname(FCM_SERVER_URL)
if self.connect((server_ip, FCM_SERVER_PORT), use_ssl = True, reattempt = False):
self.process(block=False)
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)7s %(module)12s:%(lineno)-4s %(message)s')
ClientComponent()
use_ssl
is the option I needed! Thanks
I am trying to build a very simple python3 program using sleekxmpp 1.3.1 that would be able to connect the Firebase Cloud Messaging server. I have a strange
Error reading from XML stream
issue with the following code. How can I fix it?We can see from the console output that STARTTLS is enabled. I found no other way than disable it from the sleekxmpp source code, but it does not solved the bug.
The first message sent seems valid according to the google documentation, still the "error reading from xml stream" appears.
The python code
The console output