ok great !
I think I know why I get errors, it's quite easy to understand, when the XMPP account is idle for too long (couple of hours), idle means not sending and/or receiving any message during a certain amount of time, the server disconnects you on its own ! So if I try to send a message, obviously I get an error, see below :
Code: Select all
20/12 09:28:28 Traceback (most recent call last):
20/12 09:28:28 Python script "78", line 4, in <module>
20/12 09:28:28 eg.plugins.XMPP.SendXMPP("my_own_message", u'[email protected]')
20/12 09:28:28 File "C:\ProgramData\EventGhost\plugins\XMPP\__init__.py", line 238, in __call__
20/12 09:28:28 client.send(xmpp.Message(jid, message))
20/12 09:28:28 File "C:\ProgramData\EventGhost\plugins\XMPP\xmpp\dispatcher.py", line 367, in send
20/12 09:28:28 self._owner_send(stanza)
20/12 09:28:28 File "C:\ProgramData\EventGhost\plugins\XMPP\xmpp\transports.py", line 198, in send
20/12 09:28:28 self._owner.disconnected()
20/12 09:28:28 File "C:\ProgramData\EventGhost\plugins\XMPP\xmpp\client.py", line 129, in disconnected
20/12 09:28:28 for i in self.disconnect_handlers: i()
20/12 09:28:28 File "C:\ProgramData\EventGhost\plugins\XMPP\xmpp\client.py", line 137, in DisconnectHandler
20/12 09:28:28 raise IOError('Disconnected from server.')
20/12 09:28:28 IOError: Disconnected from server.
The error is self explanatory : if there is no established connection > you can't send any messages
In other words, we need to re-connect to the XMPP server when a disconnection occurs, for example when I switch from one WiFi Access Point to another, or when I put my computer in sleep mode for a long period of time (at night for example) and powered it on again in the morning. So far, the only workaround I've found is to disable the XMPP plugin when a
System.Suspend event is fired (it logs out cleanly from the XMPP server), and I re-enable the plugin when a
System.Resume event is fired, this way I can cleanly log out/in from the server. Now the only thing that is still bothering me is when the network breaks (no more internet, or change of WiFi AP), for this I don't have any workaround as of now.
So now you have a complete comprehension of the problem, I think it would be useful to create something to detect a network or internet connection loss in the EG core ? and fire an event when connection is lost/recovered, this way we can rely on it to cope with this particular issue (and I'm sure it would be needed for many other usages). Let me know what you think about all this.