I’ve long been a fan of WordPress developer Jeffrey Pearce, better known online as Jeffikus. He’s created several educational resources for WordPress over the past few years. Today he released Pulse on github. Pulse is an open source plugin that will help developers get started with Heartbeat API development.
What is the WordPress Heartbeat API?
The Heartbeat API was a new feature as of WordPress 3.6. It currently powers the autosave, post locking and log-in expiration warning that users receive while writing posts. This API works in the background to manage communication between a user’s browser and the server, enabling the creation of WordPress-powered asynchronous apps.
Jeffikus’ Pulse plugin example demonstrates how to do two simple things:
- Outputs console data for a logged in user – the object will state that the user is logged in:
- Outputs console data for a non logged in user – the object will state that the user is not logged in:
This plugin doesn’t actually perform any specific function, except to show you how you can interact with the WordPress Heartbeat API. It’s a learning tool to help developers get started building their own plugins.
At the bottom of the Pulse plugin readme file on github Jeffikus includes a list of all the tutorials on the Heartbeat API that helped him to learn about it in the first place. If it wasn’t for other developers writing about what they are learning, he probably wouldn’t have had the inspiration to create this handy starter plugin. Hopefully, developers can use it to build something cool and help contribute back to the Heartbeat API documentation.