Add HeartbeatHandler

Add the `HeartbeatHandler` and associated `register_callback` function.