[Twisted-Python] Twisted Server and Objective-C Client

Phil Mayers p.mayers at imperial.ac.uk
Fri Sep 21 05:29:25 EDT 2007


On Thu, 2007-09-20 at 22:19 +0200, Stefan Arentz wrote:
> I need to let Objective-C (OS X / Cocoa) clients speak to a Twisted
> server. The protocol needs to be a pretty simple request/response
> style protocol on a persistent TCP connection. Possible over SSL.
> 
> Before I start inventing a wheel, does anyone know if there is
> something simple available already? Would the Perspective Broker be a
> good start? I haven't looked at the internals but maybe it is not too
> difficult to create a non-python client for it?
> 

This is sort of an FAQ.

The PB wire protocol assumes full asynchronous and symmetry; either side
of the connection can issue any callRemote at any time. The responses
may take milliseconds, minutes or days to come back.

Effectively, the PB wire protocol *is* deferreds. If your client-side
environment can support that, then it'll work. If (as seems likely) it
can't, then it won't.

If you only need simple RPC-like semantics (no callbacks from server to
client) with simple objects (strings, ints, list, dicts) XMLRPC is an
option.

Or, you could run a Twisted reactor in a thread on the client side, and
call from the main/gui thread into Twisted, let it do the PB and call
you back when it's done.

Or you could write the client in Python ;o)







More information about the Twisted-Python mailing list