[Twisted-Python] I see, remote_method can also return a deferred. Perhaps we could document that?
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
Or we could just use Brian's example. David Kao On Thu, Sep 22, 2011 at 9:19 PM, David Kao <a.libran@gmail.com> wrote:
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
On 22 Sep 2011, 01:19 pm, a.libran@gmail.com wrote:
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.
It looks like there is actually a ticket for this issue: http://twistedmatrix.com/trac/ticket/2555 with some work invested in resolving it. Anyone care to pick up where the previous developer left off? Jean-Paul
participants (2)
-
David Kao
-
exarkun@twistedmatrix.com