Move ping logic into client library