Avoid a ThreadKilled timeout in the polling thread

The polling thread now has its own timeout. If we are unable to produce
any data in 45 seconds, we simply emit a ping. Not necessarily the most
sensible response, but we don't deal with timeouts anyway at the moment,
so this is sufficient to keep the connection alive (by both parties).