   // function definition further below.
   MQTT_connect();
 
-  // Try to ping the MQTT server
-  /*
-  if (! mqtt.ping(3) ) {
-    // MQTT pings failed, lets reconnect
-    Serial.println("Ping fail!");
-  }
-  */
+  // this is our 'wait for incoming subscription packets' busy subloop
+ Adafruit_MQTT_Subscribe *subscription;
+ while ((subscription = mqtt.readSubscription(1000))) {
+   if (subscription == &pushSubscriber) {
+     Serial.print(F("Got: "));
+     Serial.println((char *)pushSubscriber.lastread);
+   }
+ }
 
-  // this is our 'wait for incoming subscription packets' busy subloop
-  Adafruit_MQTT_Subscribe *subscription;
-  while ((subscription = mqtt.readSubscription(1000))) {
-    if (subscription == &onoffbutton) {
-      Serial.print(F("Got: "));
-      Serial.println((char *)onoffbutton.lastread);
-    }
-  }
-
-  // Now we can publish stuff!
-  Serial.print(F("\nSending photocell val "));
-  Serial.print(x);
-  Serial.print("...");
-  if (! photocell.publish(x++)) {
-    Serial.println(F("Failed"));
-  } else {
-    Serial.println(F("OK!"));
-  }
+  // publish
+  // e.g. publish("{ \"params\":{ \"your_key1\":\"your_value1\", \"your_key2\":\"your_value2\",...} }");
+  pushPublisher.publish("{\"params\":{\"content\":\"from ESP8266!\"}}");
 
   delay(1000);
 }

/***************************************************
  Adafruit MQTT Library ESP8266 Example

  Must use ESP8266 Arduino from:
    https://github.com/esp8266/Arduino

  Works great with Adafruit's Huzzah ESP board:
  ----> https://www.adafruit.com/product/2471

  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Tony DiCola for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/
#include <ESP8266WiFi.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"

/************************* WiFi Access Point *********************************/

#define WLAN_SSID       "...your SSID..."
#define WLAN_PASS       "...your password..."

/************************* Adafruit.io Setup *********************************/

#define AIO_SERVER      "io.adafruit.com"
#define AIO_SERVERPORT  1883
#define AIO_USERNAME    "...your AIO username (see https://accounts.adafruit.com)..."
#define AIO_KEY         "...your AIO key..."

/************ Global State (you don't need to change this!) ******************/



// Store the MQTT server, client ID, username, and password in flash memory.
// This is required for using the Adafruit MQTT library.
const char MQTT_SERVER[] PROGMEM    = MILKCOCOA_SERVER;
// Set a unique MQTT client ID using the Milkcocoa key + the date and time the sketch
// was compiled (so this should be unique across multiple devices for a user,
// alternatively you can manually set this to a GUID or other random value).
const char MQTT_CLIENTID[] PROGMEM  = __TIME__ MILKCOCOA_USERNAME;
const char MQTT_USERNAME[] PROGMEM  = MILKCOCOA_USERNAME;
const char MQTT_PASSWORD[] PROGMEM  = MILKCOCOA_KEY;

// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
Adafruit_MQTT_Client mqtt(&client, MQTT_SERVER, MILKCOCOA_SERVERPORT, MQTT_CLIENTID, MQTT_USERNAME, MQTT_PASSWORD);

/****************************** Topic ***************************************/

// Setup a pubulisher & subscriber.
// Topic Name: "your_milkcocoa_app_id/your_milkcocoa_datastore_name/method_name"
const char PUSH_TOPIC[] PROGMEM = "your_milkcocoa_app_id/your_milkcocoa_datastore_name/push";
const char SEND_TOPIC[] PROGMEM = "your_milkcocoa_app_id/your_milkcocoa_datastore_name/send";
Adafruit_MQTT_Publish pushPublisher = Adafruit_MQTT_Publish(&mqtt, PUSH_TOPIC);
Adafruit_MQTT_Subscribe pushSubscriber = Adafruit_MQTT_Subscribe(&mqtt, PUSH_TOPIC);

/*************************** Sketch Code ************************************/

