Check cb is a function before calling it
Rename setHeartbeat to runHeartbeat. Add setHeartbeat method that updates the heartbeat configuration. Set heartbeat configuration from heart-beat connect header.