[Twisted-Python] I see, remote_method can also return a deferred. Perhaps we could document that?

David Kao a.libran at gmail.com
Thu Sep 22 09:19:38 EDT 2011


I almost gave up choosing twisted until I found this explanation

http://twistedmatrix.com/pipermail/twisted-python/2004-April/007517.html

which basically says a remote_method can return a deferred. In this
case, the PB server won't return the result of the Deferred back to
the client until the server-side callback fires. The result of the
remote_method is then returned to the client, which then triggers
client side's deferred callback.

So, I thought one of the following would be helpful:

1) An example showing remote_method returning a deferred

and/or

2) A section named "Server side remote_* methods can be async by
returning deferreds" could be added as a 7th item in

http://twistedmatrix.com/documents/current/core/howto/pb-usage.html

.

I spent some quality 30+ hours carefully reading 90% of the

http://twistedmatrix.com/documents/current/core/howto/index.html

and I do not remember picking this subtlety up. (Or you can point me
the right place in doc.) (great doc btw.)

Should I submit an improvement ticket for this? I could also make the
server side example using Echoer, remote_echo, and deferToThread just
so that whoever fixes the ticket can just copy and paste.

David Kao



More information about the Twisted-Python mailing list