in reply to Re^2: Printing to all clients on a socket from a child process
in thread Printing to all clients on a socket from a child process

I would just do it in your I/O processing loop. At the end of the loop, just check if it is time to send the keep-alive message. You can keep track of things on a per-client basis, or just use the same timing for all clients.

In your can_read call, you'll want to use a timeout value that's equal to your keep-alive period so that you won't miss sending out a keep-alive message on time.