ここで議論を見つけました: How do I disconnect my XMPPPY client object? そして、 .disconnect() が正しい方法であると言って締めくくります。
これはコードです:
while True:
try:
client.Process(5)
if not client.isConnected:
client.reconnectAndReauth()
except KeyboardInterrupt:
client.disconnect()
break;
flush_queued_messages()
これは、^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
このサーバー コードは、https: //developer.android.com/google/gcm/ccs.html の Python サンプル コードを使用して実装された gcm サーバーからのものです。
サーバーがしばらくしてメッセージの受信を停止したため、これを実装しました (SEND はまだ問題ありません)。アクティブな接続が多すぎる可能性があると考えました。サーバーに送信されたメッセージが一貫して受信されないだけです。それは私がまだ理解していない別の問題です。