[Twisted-Python] Logout from a perspective broker server

Ramiro Alba Queipo raq at cttc.upc.edu
Wed Mar 24 08:28:45 EDT 2010


Glyph,

> > I wonder, if I client using pygtk, can logout from the server
> > without
> > calling reactor.stop(), as you would kill the GUI. I tried to delete
> > the
> > perspective got from the server but it does not work...
> 
> The simplest thing you can do to achieve this is
> 'broker.transport.loseConnection()'.
> 
> 
> Of course, that just unceremoniously drops the connection.  You may
> want to have a 'remote_disconnect' method on the server too, if you
> have any state you would like to cleanly finish up with first.
> 
After having a look at pb.py code I used

factory = pb.PBClientFactory()
....

factory.disconnect()

Then this makes the server call a 'logout' method for the current
perspective, and makes a clean logout. Any comment?


> 
> Your GUI is already handling disconnection due to network problems
> though, right?  :-)  So the modification to make it handle this
> slightly-cleaner disconnect should be minor.  If it doesn't, see the
> notifyOnDisconnect API in PB:
> <http://twistedmatrix.com/documents/10.0.0/api/twisted.spread.pb.Broker.html#notifyOnDisconnect>.

Yeah. I was already using it. Very nice. I also wanted to enable a way
to conecct and disconnect from the client, apart from the client be
aware of a server restart on simply loosing connection. It works
cleanly.

Really grateful for your info and comments

Regards

> 
-- 
Ramiro Alba

Centre Tecnològic de Tranferència de Calor
http://www.cttc.upc.edu


Escola Tècnica Superior d'Enginyeries
Industrial i Aeronàutica de Terrassa
Colom 11, E-08222, Terrassa, Barcelona, Spain
Tel: (+34) 93 739 86 46


-- 
Aquest missatge ha estat analitzat per MailScanner
a la cerca de virus i d'altres continguts perillosos,
i es considera que està net.




More information about the Twisted-Python mailing list