[Twisted-Python] Is AMP a bidirectional protocol?

Nathan nathan.stocks at gmail.com
Wed Feb 27 14:20:35 MST 2008


On Wed, Feb 27, 2008 at 12:10 PM, David Ripton <dripton at ripton.net> wrote:
> On 2008.02.27 10:57:03 -0700, Nathan wrote:
>  > Is the AMP protocol bidirectional (beyond the response you get to each
>  > message)?
>
>  Yes.
>
>
>  > I'm really new to Twisted, and I followed the ampserver.py
>  > and ampclient.py examples to get an AMP connection working, because
>  > someone suggested that to me as an easy protocol to start with.
>  > Although sending a message from the client to the server works fine, I
>  > can't figure out how to initiate a message from the server to the
>  > client over the connection that the client initially created.
>  >
>  > I'm working on a little project where the "server" and the "client"
>  > actually need to talk more like peers where each can initiate a
>  > message to the other.  The server is outside the NAT, so it'd be best
>  > if the communication could happen both ways over the connection that
>  > the client initiates.
>  >
>  > Could someone point me in the right direction?  I can provide my
>  > existing code if that makes any difference.
>
>  It was non-obvious to me too.
>
>  You call callRemote on the server-side Protocol to send a message to the
>  client side.
>
>  I have a little demonstration PyGTK / AMP chat program at
>  http://ripton.net/hg/ampchat/

Oh, wow.  I was looking at your example program, and thought "I should
look at the amp api", so I googled "twisted amp" and the top link was:

http://www.ripton.net/blog/?p=16

Which is your blog post about this thread, because of this thread.  I
don't know if I should be awed that Google's so dang quick, or that by
my multitude of questions I'm causing the universe to change...  :-)

~ Nathan




More information about the Twisted-Python mailing list