Heartbeat API for WordPress

As part of the JavaScript chapter for our upcoming book Building Web Apps with WordPress, I got a chance to research and work with the Heartbeat API that is new to WordPress 3.6.

It’s a cool little piece of functionality that will help out developers building asynchronous apps on top of WordPress.

At first, I didn’t see the need for it. (It’s not too hard for developers to create their own script to poll the server every few seconds.) But I soon realized why an API like this would be useful. If  you have 5 different plugins all with their own server polling, you are going to have 5 different hits to your server every 15 seconds. However, if they all piggyback on the Heartbeat API, those polling requests are going to be bundled so you are only hitting your server 1 time every 15 seconds. There are other benefits, but that’s the big one to me.

For people trying to get started with the Heartbeat API, I put together this nice little minimal example that you can use as a starting point. The script below simply sends the message “marco” from the client and then detects this on the server and sends back “polo”. The messages are logged in the JavaScript console (so if you inspect elements and click on the console tab in Chrome you will see them). You should be able to easily tweak this to send requests like “how many members are logged in?” and send back a number, etc.

Let me know if you have any questions about the API and I’ll try to address them.

Heartbeat API for WordPress was last updated on August 7, 2013. Bookmark the permalink.

Our Book: Building Web Apps with WordPress

cover_cropBrian Messenlehner (@bmess) of WebDevStudios and I (@jason_coleman – you follow me right?) are finishing up a book for O’Reilly called Building Web Apps with WordPress. The book is for intermediate to advanced WordPress developers interested in building full on web applications using WordPress. We’re just finishing up writing now and diving into technical review with some of your favorite WordPress peeps. The book should be available for purchase later this year.

I know you are interested. So head over the book’s website to sign up for updates on when it will become available. If you are at WordCamp San Francisco, look for Brian or me to chat about the book.

Sign Up for Updates at BuildingWebAppsForWordPress.com

At last year’s state of WordPress speech, Matt Mullenweg spoke a lot about using WordPress as a framework to build web apps. I’m sure Matt will be promoting WordPress as a “web OS” during this year’s speech, and in general the use of WordPress as an application framework is going to increase as the WordPress platform and the number of good WordPress developers continues to grow.

Brian and I (and many others) have already been using WordPress to build highly interactive web apps that stretch the possibilities of what reasonable people expect to be able to do with WordPress. Our book will be the first to really dive into WordPress as a framework and codify a process for building apps with WordPress.

It’s an exciting time for us and an exciting time for WordPress.

 

 

Our Book: Building Web Apps with WordPress was last updated on July 26, 2013. Bookmark the permalink.

The Relational Capital Group

The Relational Capital Group has been a client for the past 3 years, through 2 website iterations and the development of a custom web application for their unique Business Relationship methodology—RQ®.


The Relational Capital Group was last updated on June 28, 2010. Bookmark the permalink.

Brixiom

This straightforward website showcases Brixiom’s CRM solutions for the drinks industry. We also styled and integrated the Salesforce.com Self-service Portal for Brixiom to provide tutorials, documentation, and online support to their users.


Brixiom was last updated on June 25, 2010. Bookmark the permalink.