I found the discussion here: How do I disconnect my XMPPPY client object? and it concludes with saying that .disconnect() is the right way to do it.
This is the code:
while True:
try:
client.Process(5)
if not client.isConnected:
client.reconnectAndReauth()
except KeyboardInterrupt:
client.disconnect()
break;
flush_queued_messages()
and this is the error that I receive when I press ^C
msg keys: [u'message_type', u'from', u'message_id']
DEBUG: socket got
DEBUG: socket got
DEBUG: socket got
^C DEBUG: socket sent </stream:stream>
DEBUG: socket error Socket error while receiving data
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/xmpp/transports.py", line 146, in receive
try: received = self._recv(BUFLEN)
SSLError: [Errno 8] _ssl.c:1415: EOF occurred in violation of protocol
DEBUG: client stop Disconnect detected
DEBUG: socket error Socket operation failed
This server code is from the gcm server implemented using the python sample code at https://developer.android.com/google/gcm/ccs.html
I implemented this because my server stopped receiving messages after a while (SEND is still ok) - I figured I might have too many active connections. It's just that msgs sent to the server are not received consistently. That is another problem that I haven't figured out yet.
I have shifted to Java for implementing the code. It works fine there. The most probable reason is that the documentation is a mess and the disconnect function is probably not defined well. Goes without saying that the creating that library was a good effort either way!