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.

Why We Changed The Domain of Our Book’s Site to BWAwWP.com

(Originally posted to my Google+ account.)

Just a quick post here RE why we decided (without hearing explicitly from the WordPress foundation) to change the domain of our book’s site frombuildingwebappswithwordpress.com to bwawwp.com.

So first, the original domain we chose is the full book title. It’s a pain in the butt to type all that, but we liked that the domain matched the book title exactly so readers wouldn’t get confused since there are and will be many similarly worded WordPress and app development books.

John Parris (@john_parris) and others quickly pointed out that the WordPress foundation, on their website, asks “Please do not use WordPress or WordCamp as part of a domain name.” http://wordpressfoundation.org/trademark-policy/

Many companies and orgs protecting trademarks ask the same thing and actively work to keep people from using their trademarked name in a domain name.

We were aware that the Foundation had this policy. However, it is my understanding that we have a case under “nominative fair use” to use the full WordPress term in our domain name.

The Wikipedia page explains this pretty well.
http://en.wikipedia.org/wiki/Nominative_use

Another good description and overview of a test case where a website was able to use the LEXUS brand in their domain name can be found here: http://thompsonhall.com/nominative-fair-use-allows-trademark-used-on-website-domain-name/#nominative-fair-use

So we originally went with the full domain name. After launching (very quickly) we realized that even if we weren’t going to ask permission, we should at least inform the WordPress Foundation of the domain. So I submitted a note through their contact form.

We’re all busy at WordCamp San Francisco, so I never heard back from them, but I am willing to bet that they don’t want us to use the mark in our domain name even if we have a case for it. (Maybe they’ll get back and say otherwise.) My thinking is that their thinking would be that having our site in the wild makes it a bit harder for them to ask other sites to switch domains (but Jason can do it!), etc. And they might even think that nominative use doesn’t apply. And their lawyers are probably better than our lawyers. (Hint: we don’t have lawyers.)

So expecting a no, and potentially some friction with the foundation and software community that we are trying to work with and promote, we decided to just change the name anyway. The full book title will redirect to bwawwp.comanyway, and Bwawwp! is pretty fun to say.

So that’s why we originally used WordPress in our domain name and quickly changed course without hearing directly (yet) from the WordPress Foundation.

Why We Changed The Domain of Our Book’s Site to BWAwWP.com was last updated on July 29, 2013. Bookmark the permalink.