Added a generic heartbeat method that is used to check keep alive but also do any other time related tasks.

- This also involved modifying a lot of the tests to start heartbeats instead of keep alive check loops.

#2484
Added a lastActiveAt property that is used to indicate if JavaScript is running in the browser.

- Utilized the new generic heart beat check
- Reverted the ConnectionTimeout change and left it at 110 seconds.

#2484
Addressed code review comments.

#2484