[Twisted-Python] Logout from a perspective broker server

Glyph Lefkowitz glyph at twistedmatrix.com
Wed Mar 24 05:27:13 EDT 2010


On Mar 23, 2010, at 2:30 PM, Ramiro Alba Queipo wrote:

> 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.

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>.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20100324/dac4c598/attachment.htm 


More information about the Twisted-Python mailing list