Add heartbeat support to JSONRPCServer class
Add testcase
Fix compile errors