[Twisted-Python] Detecting idle connection with perspective broker

Konrads Smelkovs konrads.smelkovs at gmail.com
Fri Apr 30 07:23:18 EDT 2010


A simple solution could be to implement a ping method with client and have
server ping client once every N seconds. At the same time, fire a delayed
call for N+5 seconds. if delayed call is executed first, drop connection.
--
Konrads Smelkovs
Applied IT sorcery.


2010/4/30 Gabriel González <gabriel at cttc.upc.edu>

> Hi there,
> I wrote a small server application with PB but now I have some problem
> with client disconnection. When I have a idle connection, the logout
> method at server never is called (this method let me have a list of
> current logged users) and then client appears always connected to
> server.
>
> I can see the same issue with the chatserver example from perspective
> broker doc with detached method.
>
> class ChatRealm:
>     implements(portal.IRealm)
>     def requestAvatar(self, avatarID, mind, *interfaces):
>         assert pb.IPerspective in interfaces
>         avatar = User(avatarID)
>         avatar.server = self.server
>         avatar.attached(mind)
>         return pb.IPerspective, avatar, lambda
> a=avatar:a.detached(mind)
>
> How can I detect that idle connection clients to call detached method?
>
> Thanks!
>
>
>
>
>
>
>
>
>
>
> --
> Aquest missatge ha estat analitzat per MailScanner
> a la cerca de virus i d'altres continguts perillosos,
> i es considera que està net.
>
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20100430/876b555d/attachment.htm 


More information about the Twisted-Python mailing list