Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Heartbeat API Jump-Start

Heartbeat API Jump-Start

As of WordPress 3.9, the Heartbeat API is no longer experimental! It’s intended to help developers synchronize data between the browser and server without manually sending individual AJAX calls. Attendees will learn Heartbeat basics and have a quick run-through on how it’s used by WordPress’ core.

Presented at WordCamp Seattle 2014 by Mike Schroder

46fa959634a063abefcac94eaf191eca?s=128

Mike Schroder

June 28, 2014
Tweet

Transcript

  1. Heartbeat API Jumpstart ! WordCamp Seattle 2014 Mike Schroder (DH-Shredder)

    @GetSource - http://www.getsource.net
  2. Who Am I? • Mike Schroder, a.k.a DH- Shredder, a.k.a.

    @GetSource • Third Culture Kid, enjoy Coffee & Sailing • WordPress 3.9 Co-Lead and co-author of Heartbeat API • Happy DreamHost Employee
  3. WAT is Heartbeat API?

  4. Realtime* Bidirectional communication via AJAX.

  5. 15-30 seconds by default. 120 seconds when inactive.

  6. None
  7. None
  8. None
  9. None
  10. None
  11. EXPERIMENTAL WARNING!

  12. EXPERIMENTAL WARNING!

  13. No longer experimental as of WordPress 3.9

  14. JS Trigger Flow ! ! -> heartbeat-send -> heartbeat-tick -/>

    heartbeat-error ! ! (wp-includes/js/heartbeat.js)
  15. PHP Filter/Action Flow ! ! -> heartbeat_received -> heartbeat_send ->

    heartbeat_tick (action) ! ! (wp-admin/includes/ajax-actions.php)
  16. This is just a start.

  17. Resources! • getsource.net/2014/01/heartbeat-api-wordcamp-phoenix/ • gist.github.com/getsource/6254495 • core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/js/heartbeat.js • pippinsplugins.com/using-the-wordpress-heartbeat-api/ Mike

    Schroder (DH-Shredder) @GetSource - http://www.getsource.net