[Twisted-web] LineReceiver Protocol

orbitz orbitz at ezabel.com
Mon Nov 22 15:09:05 MST 2004

Just use reactor.callLater to have your idle check code be scheduled to 
be called to see if the conn has been idle for too long

Michael Mata wrote:

> Is there a way to extend the LineReceiver protocol to take action on a 
> continued, periodic basis?  Currently, the protocol only does work 
> when a line is received.  However, there are times when we the script 
> to take action even without waiting to receive a line.
> For example, suppose a connection should be closed if it has been idle 
> for more than X minutes.  However, if connection is idle, it will not 
> be sending commands.  If no commands are sent, then no lines are 
> received, which means there is no way to close the connection.
> Another example might be a global message that needs to be sent to all 
> connections.  The message would have to be stored in  message queue 
> and sent only when lineReceived is called.  It would be nice if the 
> message could instead be sent imediately even if the connection was 
> currently idle.
> _______________________________________________
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

More information about the Twisted-web mailing list