Pulse: An Example WordPress Plugin Using the Heartbeat API

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.

photo credit: Lars P. via photopin cc
photo credit: Lars P. via photopin cc

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:
    output
  • Outputs console data for a non logged in user – the object will state that the user is not logged in:
    output-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.

Who is Sarah Gooding


Sarah Gooding is an Editorial Ninja at Audrey Capital. When not writing about WordPress, she enjoys baking, knitting, judging beer competitions and spending time with her Italian Greyhound.

There are 4 comments

Comments are closed.