configurable heartbeat_interval

this is a cleaned up and bug-fixed #18 and #19 cc @devdazed