[Twisted-Python] Deferreds and progress
rlotun at gmail.com
Fri Jul 27 11:15:29 EDT 2012
On Jul 26, 2012, at 11:49 AM, Tobias Oberstein
<tobias.oberstein at tavendo.de> wrote:
>>> On Thu, Jul 26, 2012 at 1:51 PM, Tobias Oberstein <tobias.oberstein at tavendo.de> wrote:
>>> With Twisted, a Deferred can have it's callback only triggered once.
>>> there is a "progress()" callback for receiving results incrementally (or merely reporting on progress
>>> until the final result arrives). Progress can be triggered more than once.
>>> Is there anything comparable in Twisted?
>> For chunks of data, Protocols; e.g. twisted.web.client.Agent delivers HTTP response bodies to a Protocol instance. More generally, Glyph is working on this: http://twistedmatrix.com/trac/ticket/1956
> Thanks for pointing. So if something like this is added to Twisted, it will be within producer/consumer, and not added to Deferred?
> The reason I am asking: Autobahn implements RPC over WebSocket, and people have been asking why RPC results
> can't be delivered in parts, as progress. However, an Autobahn RPC returns a Deferred, not a producer.
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
Probably the best way to achieve what you want is to modify your
interface to be more like the twisted.web Agent http client. In that
interface a deferred gets fired when you connect, at which point you
can optionally start consuming body data with a custom protocol
More information about the Twisted-Python