On Jul 26, 2012, at 11:49 AM, Tobias Oberstein <tobias.oberst...@tavendo.de> wrote:
>>> On Thu, Jul 26, 2012 at 1:51 PM, Tobias Oberstein >>> <tobias.oberst...@tavendo.de> wrote: >>> With Twisted, a Deferred can have it's callback only triggered once. >>> >>> With Deferreds in popular JavaScript libraries (when.js, jQuery Deferred, >>> upcoming JS PromiseA proposal), >>> 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@twistedmatrix.com > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python 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 instance. Reza _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python