Adds utils with hearbeats from Caspa.

This was before on caspa/utils.js but we'll reuse the same
to implement heartbeats for Mosto and Patero, so moving them here.