[Twisted-web] Implementing a continuous polling client in twisted
gonvaled at gonvaled.com
Mon Aug 8 14:00:51 EDT 2011
I am trying to implement a continuous polling client for couchdb change
notifications, which uses HTTP protocol (REST):
I have started by using the agent described here:
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
ClientCreator is not doing reconnection. I would like to implement a similar
class to ClientCreator, but one which uses ReconnectingClientFactory
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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-web