Hi,
I am new to Sleekxmpp. my requirement is to verify the FCM credentials. If i use self.connection.process() then it will triggers the auth_success/auth_failed events then i get the self.auth value as True, Below is my code. Is there anyways to verify the FCM credentials without process() ? Please help me
Note : I am calling verify_credentials from main thread.
from sleekxmpp import ClientXMPP
class GCM:
self.conn=None
self.auth=False
def open_conn(jid, password):
self.conn=ClientXMPP(jid,password, sasl_mech="PLAIN")
self.conn.add_event_handler("auth_success", self.auth_success)
self.conn.add_event_handler("failed_auth", self.auth_failed)
self.conn.connect((host,port), use_ssl=True)
def auth_success(self,event):
self.auth=True
def auth_failed(self,event):
self.auth=False
def verify_credentials(jid, password):
self.open_conn(jid,password)
if self.auth:
print("success")
else:
print("failed auth")
c=GCM()
a=c.verify_credenatils(jid,password)
print(a)