chatbot using twisted and wokkel

Posted by dmitriy k. on Stack Overflow See other posts from Stack Overflow or by dmitriy k.
Published on 2010-05-01T23:31:50Z Indexed on 2010/05/01 23:37 UTC
Read the original article Hit count: 236

Filed under:
|
|
|

I am writing a chatbot using Twisted and wokkel and everything seems to be working except that bot periodically logs off. To temporarily fix that I set presence to available on every connection initialized. Does anyone know how to prevent going offline? (I assume if i keep sending available presence every minute or so bot wont go offline but that just seems too wasteful.) Suggestions anyone? Here is the presence code:

class BotPresenceClientProtocol(PresenceClientProtocol):

    def connectionInitialized(self):
        PresenceClientProtocol.connectionInitialized(self)
        self.available(statuses={None: 'Here'})

    def subscribeReceived(self, entity):
        self.subscribed(entity)
        self.available(statuses={None: 'Here'})

    def unsubscribeReceived(self, entity):
        self.unsubscribed(entity)

Thanks in advance.

© Stack Overflow or respective owner

Related posts about twisted

Related posts about chatbot