Implementing a continuous polling client in twisted

Daniel Gonzalez <[email protected]>
Newsgroups gmane.comp.python.twisted.web
Message-ID <CAAOi-OE7b1X7fS_FbDtd36GqV91SaRSKK5e7ZgzpsHGO=6pLPQ@mail.gmail.com>
Hello,

I am trying to implement a continuous polling client for couchdb change
notifications, which uses HTTP protocol (REST):

http://guide.couchdb.org/draft/notifications.html

I have started by using the agent described here:
http://twistedmatrix.com/documents/current/web/howto/client.html

This is working fine, but the problem is that the connection is not
permanent: it is being closed after a timeout (I think 1 minute).
For continuous polling, I need to keep the connection open (forever), or if
that is not possible, to reconnect as soon as the connection is closed.

I have taken a look at the code, and the problem seems to be that the Agent
(twisted/web/client.py) class is using ClientCreator
(twisted/internet/protocol.py)
ClientCreator is not doing reconnection. I would like to implement a similar
class to ClientCreator, but one which uses ReconnectingClientFactory
(twisted/internet/protocol.py)

I have not found any guidance in using ReconnectingClientFactory. According
to the documentation:

"Note that clients should call my resetDelay method after they
have connected successfully."

The difficulty I have is that the factory is not returning any deferred
which I could use to catch when connections are established, and then call
the resetDelay method.

Do you have any pointers to examples of use of ReconnectingClientFactory?

BR,
Daniel Gonzalez

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.