Heartbeats and stale socket detection