   {
     //oops we're not connected yet or we lost connection
     Serial.println(F("connecting..."));
-
-    // attempt to connect to Wifi network:
-    while (status != WL_CONNECTED) {
-      Serial.print("Attempting to connect to SSID: ");
-      Serial.println(ssid);
-      // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
-      status = WiFi.begin(ssid, pass);
-  
-      // wait 10 seconds for connection:
-      delay(10000);
-    }
       
     // skynet doesnt use client so send empty client string and YOUR UUID and token
     if (skynet.connect("", UUID, TOKEN)){

//another UUID well send a message to
char TOUUID[] = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"; 

WiFiClient client;
PubSubClient skynet(server, 1883, onMessage, client);

//we'll run this if anyone messages us

 * This sketch uses the MQTT library to connect to skynet. It sends a message
 * on successful connection and logs data every second.
 *
 * Requires the MQTT library from Nick O'Leary http://knolleary.net/arduino-client-for-mqtt/
 * And one modification in PubSubClient.h, increase MQTT_MAX_PACKET_SIZE from 128 to something like 256
 *
 * Works with ethernet shields compatible with EthernetClient library from
 * Arduino. If you don't know, grab the original 
 * http://arduino.cc/en/Main/ArduinoEthernetShield
 *
 * Remember not to mess with ethernet's unavailable pins (10, 11, 12, 13 and 4 if using SD card)
 *
 * You will notice we're using F() in Serial.print. It is covered briefly on
 * the arduino print page but it means we can store our strings in program
 * memory instead of in ram.
 *
 */

#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>

//you can't have 2 of the same mac on your network!
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

char server[] = "skynet.im";

