How do I disconnect my XMPPPY client object

前端 未结 2 1992
情深已故
情深已故 2021-01-14 07:45

Connecting to an XMPP server with XMPPPY is simple.

from xmpp.client import Client as XMPPClient

self.xmppClient = XMPPClient(\"jabber.foo.com\")
if not sel         


        
2条回答
  •  被撕碎了的回忆
    2021-01-14 07:56

    Generally speaking, if you want to disconnect from an XMPP server, you'll send a Presence stanze with type='unavailable', like the following:

    
    

    Note that Presence does NOT have a recipient address. Here's a link to XMPP's RFC in case you'd like to know more. (Section 5.1.5)

    After that, you can gracefully disconnect from the server, since the presence you sent basically tells the server, "I'm out.".

    I took a look at the XMPPPY documentation (Yes, I agree that it has room for improvement), and it seems xmpp.Client.Client contains a function call sendPresence(...). You might be able to send an unavailable presence using the function?

    Here's the API Documentation: http://xmpppy.sourceforge.net/apidocs/xmpp.client.Client-class.html#sendPresence

提交回复
热议问题