PubNub provides an easy to use interface for IoT enabled devices .PubNub and NodeMcu makes great pair to create IoT enbled embedded Devices. It is simple Publish and Subscribe based protocol. Where any device can subscribe to any channel with subscribe key and could receive all messages published to that channel. On the other hand With simple REST Requests any device can also be a publisher to a specific channel and issue commands, data or any other information related to that channel.
Here are some usefull resources to get started
As we are only interested in last issued command so we can use this URL to access the last command issued by a publisher on our channel
To publish data over some channel you can use following URL
http://pubsub.pubnub.com /publish /pub-key /sub-key /signature /channel /callback /messageCode language: PHP (php)