WordPress 3.6 introduced the “Heartbeat API”. This API is used internally by WordPress to keep track of logged in users and their active sessions. If you’ve ever been asked to log into WordPress while navigating the admin panel, then you’ve already experienced the API at work.
But when should you use the Heartbeat API in contrast to regular AJAX polling? To make an informed decision, we’ll need to look at both approaches, understand how they work and how to use them, and the advantages and disadvantages for both.